![]() |
|
| |||||||
| Notices |
| mySQL & PHP Discussions, information and help with mySQL and PHP. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| ||||
| ||||
|
This is probably something very basic, but I searched for its meaning for a while now. What is this -> I saw this in an example script, $this-> what does this mean, im sure its something simple and i should know this. :)
__________________ No its not Fowbers its foobers :D |
|
#2
| ||||
| ||||
|
$this-> is used in what is called a class, which is the build block of OOP (Object Oriented Programming). Basically a class is a set of functions and variables that work together. It allows for easily doing a task without needed to know how it works, just what functions need to be called and (possible in a certain order). This is the idea of OOP, being able to use certain reusable code without needing to know what exactly how a group of functions work together, just what the functions do and do together. That being said, to explain what $this is. Basically its just a reference to a calling object, the object being a variable in your script that is declared as an object of the class. It is hard to explain more exactly without you having an example of a class infront of you. Here is a example on php.net http://us2.php.net/manual/en/ref.classobj.php If you need further clarification I can try to explain a little more in depth, but for a really simple answer, its a object variable used in classes
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |