An old colleague of mine wrote this in our code:
public function paginate() {
return $this->paginate;
}
And I was wondering: does this return the function paginate() or the class property $paginate?
I'm guessing the latter, but it is strange that I haven't found any information on this subject.
A PHP class, and more generally, object-oriented programming, provides additional approaches to reusability, and can be used for a variety of purposes: They can describe entities that have known properties and behaviors. They can be used as messages to functions and other objects.
PHP has more than 1000 built-in functions, and in addition you can create your own custom functions.
Yes, the latest versions of PHP are object oriented. That is, you can write classes yourself, use inheritance, and where appropriate, the built in functionality is built in objects too (like MySQL features).
That returns the class property $paginate
.
If it was return $this->someName();
then it returns function someName()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With