Re: Pseudo-objects (methods on arrays, strings, etc.)

From: Date: Tue, 17 Jul 2012 17:50:28 +0000
Subject: Re: Pseudo-objects (methods on arrays, strings, etc.)
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-61372@lists.php.net to get a copy of this message
Hi! > I am for making array a proper class with methods. > > "Legacy" functions can be implemented as wrappers around it: > > function array_push(&$array, $value) > { > $array->push($value); > } The problem there is that array has different semantics than object. Not completely, but for example if you pass array to function, it is passed by value and is not modified, but objects are always mutable when passed to functions. Changing this semantics will break a lot of code. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#61372) next »