Posted by Toby A Inkster on 05/17/07 12:38
thaertel wrote:
> Example 1 is a C like operator. Almost like an object in OOP
> programming. $engine is like a pointer to the value
> do_themefooter($index); returns. Which is what happens in this sense.
It's not "almost like" an object.
It is the operator that allows you to access properties and methods of an
object. It's analogous to the square brackets when using arrays.
$foo['bar'] is to arrays
As $foo->bar is to objects.
Despite looking like a little arrow, it's not got anything to do with
pointers in a C sense of the word. $engine isn't a pointer to the value
do_themefooter($index) returns.
$engine is an object -- a "thing" of some kind, and it has a method
do_themefooter(). A "method" is just "something that an object is capable
of doing". So "$engine->do_themefooter()" just means: ask $engine to
perform its "do_themefooter()" action. Like this:
$dog->chase($cat);
Dog isn't a "pointer to the cat chasing function". Dog is the thing that's
actively doing the chasing.
--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
[Back to original message]
|