Re: Reference or copy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




In both PHP 4 and PHP 5, this would be an internal reference:

$a = $b;

until $b is changed.

The only exception is with Object handling under PHP 4, which had flawed reference handling.

So, the rule remains -- don't use references for performance reasons -- use them if you need references. :-)


~Ted



On 23-Jul-08, at 1:20 PM, Yeti wrote:

<?php
# So if i want a copy in PHP, like:

$a = $b;

# In PHP5 $a would still be a reference as long as $b is not being changed?(!)
# Such behaviour makes it extremely easy to write a speedy script
without worrying about copy/reference issues!

# Thanks to all of you,
# Ernie
?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux