note 86498 added to function.array-walk

From: Date: Wed, 22 Oct 2008 10:57:01 +0000
Subject: note 86498 added to function.array-walk
Groups: php.notes 
Request: Send a blank email to php-notes+get-145572@lists.php.net to get a copy of this message
Although the manual warned you not to unset element, but sometimes thus is very useful and work as charm: $arrChnOut=array(0=>array('ID' => '13', 'ChannelName' => 'Computers' ), 1=>array('ID' => '17', 'ChannelName' => 'Computers' ), 2=>array('ID' => '18', 'ChannelName' => 'Computers' ), ); array_walk($arrChnOut, create_function('&$v, $k, $arr_rtn', 'if ($k{0}!="_"){$arr_rtn["_".$v[\'ID\']]=$v;unset($arr_rtn[$k]);}'), &$arrChnOut); var_export($arrChnOut); ---- Server IP: 208.69.120.35 Probable Submitter: 64.70.54.16 ---- Manual Page -- http://www.php.net/manual/en/function.array-walk.php Edit -- https://master.php.net/note/edit/86498 Del: integrated -- https://master.php.net/note/delete/86498/integrated Del: useless -- https://master.php.net/note/delete/86498/useless Del: bad code -- https://master.php.net/note/delete/86498/bad+code Del: spam -- https://master.php.net/note/delete/86498/spam Del: non-english -- https://master.php.net/note/delete/86498/non-english Del: in docs -- https://master.php.net/note/delete/86498/in+docs Del: other reasons-- https://master.php.net/note/delete/86498 Reject -- https://master.php.net/note/reject/86498 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145572) next »