Re: [SMARTY-DEV] Re: [SMARTY]Re:[SMARTY-DEV]$smarty.session.object doesn't work in 2.5.0
| From: | messju mohr | Date: | Tue, 15 Apr 2003 20:20:55 +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-1169@lists.php.net to get a copy of this message | ||
On Tue, Apr 15, 2003 at 10:03:23PM +0200, 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.
reference-counting is used internally by php for garbage-collection,
AFAIK, but not visible to the application-programmer. but any
assignment implies a copy of the data.
try sth. like this:
1: $a = array('a');
2: $b = $a;
3: $a[] = 'b';
if a reference was assigned in line 2, then $b would be "array('a',
'b')"
since it references the same entity as $a. but since a copy is done in line
2, $a is changed in line 3, but $b is not.
greetings
messju
> Regards,
> David