Announcement

Collapse
No announcement yet.

Simple Php problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple Php problem

    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
    Re: Simple Php problem

    $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



    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

    Comment


    • #3
      Re: Simple Php problem

      No worries watdaflip i fully understood what you just said. Thnx for clearing it up for me. Thnx for your help :)
      No its not Fowbers its foobers :D

      Comment

      Working...
      X