Simple Php problem

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

    • Oct 2007
    • 34

    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
  • Watdaflip
    Major General

    • Sep 2005
    • 2116

    #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

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    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

    • Phoubers
      Sergeant

      • Oct 2007
      • 34

      #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