Normally I wouldn't ask a question this simple

Discussion in 'PHP' started by ChaosFoo, Feb 21, 2008.

  1. #1
    I know that this is a simple question. However, due to the nature of the question, I can't find any information by searching for it. :)

    What does the below mean in PHP?

    
    ->
    
    Code (markup):
    Is it similar to this?
    
    .=
    
    Code (markup):
    If so, what are the differences? Or, can someone send me a link to where I can learn more about it?

    Thanks
     
    ChaosFoo, Feb 21, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    -> is associated with PHP Classes
    .= means append this to the variable

    Now you have the basic meaning, I'm sure you can look it up ;)

    Jay
     
    jayshah, Feb 21, 2008 IP
  3. ChaosFoo

    ChaosFoo Peon

    Messages:
    232
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. I now know that -> is associated with PHP classes. However, PHP classes is quite a large subject, and there is a lot of information about PHP classes.

    I have searched many PHP websites for '->'. Unfortunately, none of them pull up anything. Probably because most search engines don't consider -> a valid search.

    I know this is something so simple that most people don't even mention what it does because it is common knowledge. Does anyone have a more in depth explaination.
     
    ChaosFoo, Feb 21, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    nico_swd, Feb 21, 2008 IP
  5. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #5
    shallowink, Feb 21, 2008 IP
  6. ChaosFoo

    ChaosFoo Peon

    Messages:
    232
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Perfect! Thanks!
     
    ChaosFoo, Feb 21, 2008 IP
  7. The Critic

    The Critic Peon

    Messages:
    392
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Examples:
    
    class MyClass {
         public $var;
    
         function isTrue() {
         return $this->var;
         }
    }
    //Instantiate a new object
    $object=new MyClass(param);
    //Set the MyClass member 'var' to true
    $object->var=true;
    //Call method isTrue, which returns the value of member 'var'
    if($object->isTrue()) {
    echo  "Class member var is true.";
    }
    //Outputs "Class member var is true."
    
    PHP:
     
    The Critic, Feb 21, 2008 IP