What does $variable->something mean?
Posted: Mon Oct 09, 2006 1:24 pm
Hello
I have been using PHP for a while, but I often end up reusing old code and rarely learning new stuff.
I have seen on a lot of code (included the PHPBB code) that in PHP code sometimes look like:
or
or something very similar. I would like to start using this more in my code because I have been told about the benefits.
Can someone tell me:
(a) what does the -> do ?
(b) what is the concept called?
(c) can you give me a brief example?
Huge thanks
Hamish
I have been using PHP for a while, but I often end up reusing old code and rarely learning new stuff.
I have seen on a lot of code (included the PHPBB code) that in PHP code sometimes look like:
Code: Select all
$variable->somethingCode: Select all
$handle = db_connect();
$pages_sql = 'select * from table';
$result = $handle->query($pages_sql);Can someone tell me:
(a) what does the -> do ?
(b) what is the concept called?
(c) can you give me a brief example?
Huge thanks
Hamish