|
Posted by Steve on 12/19/07 17:17
"Logos" <tyler.style@gmail.com> wrote in message
news:629d3852-7498-474c-9ed7-de84ec3e98d5@e25g2000prg.googlegroups.com...
> On Dec 13, 3:16 pm, Michael Fesser <neti...@gmx.de> wrote:
>> .oO(gosha bine)
>>
>> >in addition to what's already said, there's no need to use references
>> >in php5.
>>
>> At least when working with objects. But nevertheless
>>
>> $foo = new Test();
>> $a = $foo;
>> $b = &$foo;
>>
>> are still different things, even in PHP 5. In some particular situations
>> this might become an issue.
>>
>> Micha
>
> Oooo...errr...ummm...could someone explain how exactly those are
> different when using PHP5, then, please? If everything is done by
> reference for objects, then to me $a and $b both look like pointers to
> an object.
>
> And...are objects always passed by reference to functions in PHP5,
> then?
alright, get ready for a ton of flamage here after i'm done...
first, to be correct and accurate...objects are passed to functions by
reference, objects in arrays are by reference (i.e. when using foreach),
etc., etc.. variable assignment is by value. while $b = &$foo behaves like a
pointer in *every* way, in php there are no true c-style pointers. $b is
just an alias for $foo, a nickname...because of the amphersand (&). make
sense?
Navigation:
[Reply to this message]
|