Wondering if this is possible in PHP Land:
Let's say I have a class as follows:
class myClass{
var $myVar;
...
myMethod(){
$this->myVar = 10;
}
}
and another class:
class anotherClass {
...
addFive(){
$this->myVar += 5;
}
}
The 'anotherClass' is 3500 lines long and I just want the single 'addFive' method to use in myClass.
- Is there a way I can import the function and be able to call it in my class and the $this would reference the myClass object?
- Is this good/bad practice?
- (optional) How does this work in Python? (Just curious as I'm starting to learn Python)