Feature request: clone() function

php.internals

Christian Schneider

22 years ago
I'd like to see a clone() (or whatever name you want) function which should exist in both PHP4 and PHP5 and allows to clone objects in a compatible way. Currently I'm using function &clone(&$object) { return (is_object($object) && version_compare(zend_version(), '2.0.0-dev', '<')) ? $object : $object->__clone(); } but I think this should be provided by PHP itself to easy migration. As always I'd be willing to provide an implementation if wanted ;-) - Chris