Hi,

I've read "PHP 4: Reference Counting and Aliasing" By Andi Gutmans on Zend.com site 
(http://www.zend.com/zend/art/ref-count.php). Also I read this mail 
http://marc.theaimsgroup.com/?l=php-dev&m=100955714924477 from him.

I would like to know more about how reference is managed by PHP4. I'm missing 
something like that article (see the first URL) for reference.

What happens inside PHP4 with this code ?

<?

$a = 5;
$b = $a;
$c = &$b;
$d = $c;

?>

How PHP4 know that $c and d are reference to $a and not "counted" like $b ? And so 
what makes references so bad ? ;-)

Another (more important) example:

<?

function foo( $msg )
{
  $tmp = &$msg;
  return $tmp;
}

?>

What happens to $tmp ? If it will not refer to a new memory block why the memory used 
by the script is more than without '&' ? (See the second URL).

Thanks.


Ed



___________________________________
Build high quality traffic with the Web's Premier traffic building system. 2 to 1 
ratio! http://www.itrafficstar.com/?ref=6



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to