Home » PHP » PHP_Compat » Bug #2769
Object cloning
Details
| Request #2769 | Object cloning |
|---|---|
| Submitted | 2004-11-16 16:21 UTC |
| From | ylf at xung dot org |
| Assigned | aidan |
| Status | Closed |
| Package | PHP_Compat |
| PHP Version | 4.3.4 |
| OS | Linux Debian |
| Roadmaps | (Not assigned) |
Comments
[2004-11-16 16:21 UTC] ylf at xung dot org
Description:
------------
AFAIK, to clone an object you need to write :
php4 : $a = $b;
php5 : $a = clone $b;
The problem is that if one wants to write portable code the statement "$a = $b" will behave differently in php4 and php5.
While googling about this issue I found this very nice article by Steven Wittens :
http://www.acko.net/node/54
He proposes to use a function-like clone() syntax, which works natively in php5 (= no ovherhead). I believe this is a great idea.
[2004-11-16 16:23 UTC] ylf at xung dot org
Changed to feature request.