note 73936 added to language.types.array

From: Date: Fri, 16 Mar 2007 09:44:27 +0000
Subject: note 73936 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-124503@lists.php.net to get a copy of this message
On array recursion... Given the following code: <? $myarray = array('test',123); $myarray[] = &$myarray; print_r($myarray); ?> The print_r() will display *RECURSION* when it gets to the third element of the array. There doesn't appear to be any other way to scan an array for recursive references, so if you need to check for them, you'll have to use print_r() with its second parameter to capture the output and look for the word *RECURSION*. It's not an elegant solution, but it's the only one I've found, so I hope it helps someone. ---- Server IP: 87.124.64.96 Probable Submitter: 212.84.170.86 (proxied: 1.1 SKYMARKETISA) ---- Manual Page -- http://www.php.net/manual/en/language.types.array.php Edit -- https://master.php.net/note/edit/73936 Del: integrated -- https://master.php.net/note/delete/73936/integrated Del: useless -- https://master.php.net/note/delete/73936/useless Del: bad code -- https://master.php.net/note/delete/73936/bad+code Del: spam -- https://master.php.net/note/delete/73936/spam Del: non-english -- https://master.php.net/note/delete/73936/non-english Del: in docs -- https://master.php.net/note/delete/73936/in+docs Del: other reasons-- https://master.php.net/note/delete/73936 Reject -- https://master.php.net/note/reject/73936 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124503) next »