14 Dec
2005
14 Dec
'05
9:56 p.m.
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.