PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » PHP » PHP_Compat » Bug #2769

Object cloning

Details

Request #2769Object cloning
Submitted2004-11-16 16:21 UTC
Fromylf at xung dot org
Assignedaidan
StatusClosed
PackagePHP_Compat
PHP Version4.3.4
OSLinux 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.