note 84788 added to function.implode

From: Date: Wed, 30 Jul 2008 11:30:01 +0000
Subject: note 84788 added to function.implode
Groups: php.notes 
Request: Send a blank email to php-notes+get-142920@lists.php.net to get a copy of this message
Many of the functions below can be simplified using this short function: <?php function array_implode($arrays, &$target = array()) { foreach ($arrays as $item) { if (is_array($item)) { array_implode($item, $target); } else { $target[] = $item; } } return $target; } $a = array('a', 'b', array('c', 'd', array('e'), 'f'), 'g', array('h')); echo join(' - ', array_implode($a)); ?> The outputs: <?php a - b - c - d - e - f - g - h ?> ---- Server IP: 89.248.170.61 Probable Submitter: 86.89.178.165 ---- Manual Page -- http://www.php.net/manual/en/function.implode.php Edit -- https://master.php.net/note/edit/84788 Del: integrated -- https://master.php.net/note/delete/84788/integrated Del: useless -- https://master.php.net/note/delete/84788/useless Del: bad code -- https://master.php.net/note/delete/84788/bad+code Del: spam -- https://master.php.net/note/delete/84788/spam Del: non-english -- https://master.php.net/note/delete/84788/non-english Del: in docs -- https://master.php.net/note/delete/84788/in+docs Del: other reasons-- https://master.php.net/note/delete/84788 Reject -- https://master.php.net/note/reject/84788 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142920) next »