On Fri, 2007-09-21 at 16:18 +0100, Ben wrote: > It really depends on your situation. > We are an ISP hosting lots of website. Upgrading from 4 to 5 means a lot of > sites will have trouble. > Personally I have some problem of upgrading from 4 to 5. > > The below codes work on 4: > > include("DB/DataObjects.php"); > $pro = DB_DataObject::factory('Product'); > $pro->find(); > while($pro->fetch()) > $allPro[] = $pro; > > But on 5, it has to be modified to > include("DB/DataObjects.php"); > $pro = DB_DataObject::factory('Product'); > $pro->find(); > while($pro->fetch()) > $allPro[] = clone $pro; > > The above is only an example. So upgrading to 5 is not an option for us. You might want to start a migration path for your code in the near future. i would suggest something like the following: <?php # File: myLib.php function &myClone( &$someObject ) { static $init = true; if( $init ) { if( (int)phpversion() < 5 ) { require_once( 'php4Compat.php' ); } else { require_once( 'php5Compat.php' ); } } $clone = &compat_myClone( $someObject ); return $clone; } # File: php4Compat.php function &compat_myClone( &$someObject ) { $clone = $someObject; return $clone; } # File: php5Compat.php function &compat_myClone( &$someObject ) { $clone = clone $someObject; return $clone; } ?> This way you can still use PHP4 while providing the necessary changes for PHP5 before fully switching over. Cheers, Rob. Ps. I used references so PHP4 wouldn't create copies at every function call :) -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ........................................................... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php