|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-05-05 18:14 UTC] requinix@php.net
-Status: Open
+Status: Wont fix
-Package: Feature/Change Request
+Package: *General Issues
[2018-05-05 18:14 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
Description: ------------ An extra magic method that works in the same was as __clone but is called when an object is assigned in the normal way. Code earlier that php5 could be fixed in one place by adding a single method to a class rather than having to find every $obj1 = $obj2 line in your scripts. Reproduce code: --------------- <?php class MyClass { public function __copy { echo 'I want to return a copy, not a reference, like in olden days'; return clone($this); } } $obj1 = new MyClass; $obj2 = $obj1; ?>