note 112009 deleted from function.array-merge-recursive by googleguy

From: Date: Mon, 22 Apr 2013 04:32:40 +0000
Subject: note 112009 deleted from function.array-merge-recursive by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-194588@lists.php.net to get a copy of this message
Note Submitter: Certainist ---- On "array_flatten", you can avoid recursion by following statement. This is the non-recursive simplest array_flatten. <?php function array_flatten($arr) { $arr = array_values($arr); while (list($k,$v)=each($arr)) { if (is_array($v)) { array_splice($arr,$k,1,$v); next($arr); } } return $arr; } ?>

« previous php.notes (#194588) next »