On Wed, 2013-05-08 at 10:42 +0200, Ferenc Kovacs wrote: > 2013.05.08. 7:38, "Pierre du Plessis" <pie...@pcservice.co.za> ezt írta: > > > > The __toArray can be useful if you want to perform array functions on the > > object (E.G array_filter), otherwise I think it would be very useful if > > the
This can't work. Consider <?php class C { public function __toString() { return "string"; } public function __toArray() { return []; } } $result = str_replace(new C, new C, new C); ?> Which method will be called? > > array functions can accept an object implementing ArrayAccess as well > > instead of just an array > > yeah, I also think that ArrayObjects should be accepted where array is > expected. Patches are certainly welcome, but be sure to get to every place, else it becomes an inconsistent mess :) Oh, and be consistent about return values of operations ... oh, and will $result = some_array_operation(new ArrayObject); return an array or instance of ArrayObject, if the later how will it be instantiated ... do we have to pass result factories or something to all of those? johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php