note 73585 added to function.unserialize
| From: | BenBE at omorphia dot de | Date: | Fri, 02 Mar 2007 14:20:29 +0000 |
| Subject: | note 73585 added to function.unserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124011@lists.php.net to get a copy of this message | ||
When trying to serialize or unserialize recursive arrays or otherwise linked data you might find the
undocumented R data type quite useful.
If you want a array like the one produced with
<?
$a = array();
$a[0] =& $a;
?>
serialized you can store it using a string simular to this one:
<?
$a = unserialize("a:1:{i:0;R:1;}");
?>
Both sources will make $a hold an array that self-references itself in index 0.
The argument for R is the index of the created sub-variable of the serialize-string beginning with
1.
----
Server IP: 217.13.201.10
Probable Submitter: 217.93.237.219
----
Manual Page -- http://www.php.net/manual/en/function.unserialize.php
Edit -- https://master.php.net/note/edit/73585
Del: integrated -- https://master.php.net/note/delete/73585/integrated
Del: useless -- https://master.php.net/note/delete/73585/useless
Del: bad code -- https://master.php.net/note/delete/73585/bad+code
Del: spam -- https://master.php.net/note/delete/73585/spam
Del: non-english -- https://master.php.net/note/delete/73585/non-english
Del: in docs -- https://master.php.net/note/delete/73585/in+docs
Del: other reasons-- https://master.php.net/note/delete/73585
Reject -- https://master.php.net/note/reject/73585
Search -- https://master.php.net/manage/user-notes.php