Re: [SMARTY-DEV] Re: [SMARTY]Re:[SMARTY-DEV]$smarty.session.object doesn't work in 2.5.0

From: Date: Tue, 15 Apr 2003 20:26:33 +0000
Subject: Re: [SMARTY-DEV] Re: [SMARTY]Re:[SMARTY-DEV]$smarty.session.object doesn't work in 2.5.0
References: 1 2 3 4 5 6 7 8 9  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1170@lists.php.net to get a copy of this message
ugh :-) IIRC,We're talking about assigning variables in Smarty via the assign() class method call. If you look at the assign() method, you will see that arrays are broke apart with a foreach() loop, thus forcing a copy, not a reference. So, examples of Smarty & PHP (4.x): $bar = 'blah'; $foo = $bar; <-- REFERENCE $smarty->assign('foo', $bar); <-- REFERENCE $bar = array('blah','blah2'); $foo = $bar; <-- REFERENCE $smarty->assign('foo', $bar); <-- COPY Monte On Tue, 2003-04-15 at 15:03, Wom.bat wrote: > > The value is not referenced if: > > > > 1) the value being assigned is an array > > 2) the value being assigned is an object > > > > Otherwise you are correct, only a reference counter is incremented. > > No Monte, sorry, but you are wrong. Please read > http://www.zend.com/zend/art/ref-count.php again, there > you'll find this at > multiple points in the document, for exampe at "Reference Counting in PHP4": > "Reference counting is used for all the PHP 4 basic data types: such as > integers, booleans, strings, arrays, objects and resources" > Below that statement, you'll find more proof on that. > > Regards, > David -- Monte Ohrt <monte@ispi.net>

« previous php.smarty.dev (#1170) next »