[development] performance foo

Moshe Weitzman weitzman at tejasa.com
Wed Dec 14 20:56:43 UTC 2005


Neil Drumm wrote:
> Chris Johnson wrote:
> 
>> Interesting idea.  So I rewrote object2array() and better() like this:
>>
>> function object2array($object) {
>>     return get_object_vars($object);
>> }
>>
>> function better($object) {
>>     return (array) $object;
>> }
> 
> 
> Why do we even need these one-line functions? Can't the calling code 
> just do the casting?

not always. there are contexts in which function is legal but a cast is 
not. if anyone tries to change all the calls to these objects they will 
run into this.


More information about the development mailing list