+ Reply to Thread
Results 1 to 3 of 3

Thread: Simple Php problem
      
   

  1. #1
    Phoubers's Avatar
    Phoubers is offline Sergeant
    Join Date
    Oct 2007
    Location
    :D
    Posts
    34

    Default 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. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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

    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

  3. #3
    Phoubers's Avatar
    Phoubers is offline Sergeant
    Join Date
    Oct 2007
    Location
    :D
    Posts
    34

    Default 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49