[support] PHP 5.3 upgrade problems
    larry at garfieldtech.com 
    larry at garfieldtech.com
       
    Thu Oct 15 19:20:03 UTC 2009
    
    
  
andy baxter wrote:
> Pierre Rineau wrote:
>> It depends on the parameter type.
>>
>> If your parameter is a primitive type (int, string, float, bool) or an
>> array, value will be used (this will be a local variable into your
>> function), but if you pass a class (stdClass or any other) then it will
>> be a reference, whether you wrote the & or not.
>>   
> This is what I was thinking it might be. I've programmed in other 
> languages before but not PHP, and I didn't know how PHP deals with 
> things like this.
> 
> Thanks,
> 
> andy
Not entirely true, actually.  In PHP 5, objects are split into the 
actual object and a handle to that object.  The handle passes by value, 
but the object itself is still the same one being referenced.  So it 
behaves about 93% of the time as if objects pass by reference.  There 
are edge cases where that's not true, however, so don't get into the 
"object => pass by ref" trap.  It's only "true" 93% of the time. :-)
--Larry Garfield
    
    
More information about the support
mailing list