Maybe this is just a simple thing, but I haven't been able to search for it 'cause of the syntax, even if I enclose it like "->", search engines and forum search engines seem to nos recognize it.
I just need to know what it the usage of "->" in PHP and if it has a name so I can research more about it...
Can anybody explain the usage of "->"?
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Can anybody explain the usage of "->"?
That is an object notation. Here's an example:
$this is a special variable referring to the current object instance. For more information on objects, classes, and object oriented programming, here are some links.
http://php.net/manual/en/language.oop5.php
http://www.google.com/#q=php+object+ori ... rogramming
Code: Select all
class Person {
public $height;
public $age;
function setAge($age) {
$this->age = $age;
}
}
$instance = new Person();
$instance->setAge(20);
echo $instance->age; // outputs "20"
$instance->height = '5-4';
echo $instance->height; // outputs "5-4"http://php.net/manual/en/language.oop5.php
http://www.google.com/#q=php+object+ori ... rogramming
Re: Can anybody explain the usage of "->"?
Great! Thank you Jonah. Now I know a little bit more but the most important is that now I know how to look for it.