note 104983 added to function.array-splice

From: Date: Wed, 20 Jul 2011 15:20:58 +0000
Subject: note 104983 added to function.array-splice
Groups: php.notes 
Request: Send a blank email to php-notes+get-181722@lists.php.net to get a copy of this message
Sometimes you may want to insert one array into another and just work on with the resulting array. array_splice() doesn't support this, as the resulting array isn't the returned value but the first argument, which is changed by reference. Therefore you may use the following function, which inserts array $ins in array $src at position $pos. $rep can be used if $ins shouldn't be just inserted, but should replace some existing elements (the number of elements to be replaced is given in $rep). function array_insert($src,$ins,$pos,$rep=0) { array_splice($src,$pos,$rep,$ins); return($src); } ---- Server IP: 85.214.154.209 Probable Submitter: 80.153.162.95 (proxied: 127.0.0.1) ---- Manual Page -- http://www.php.net/manual/en/function.array-splice.php Edit -- https://master.php.net/note/edit/104983 Del: integrated -- https://master.php.net/note/delete/104983/integrated Del: useless -- https://master.php.net/note/delete/104983/useless Del: bad code -- https://master.php.net/note/delete/104983/bad+code Del: spam -- https://master.php.net/note/delete/104983/spam Del: non-english -- https://master.php.net/note/delete/104983/non-english Del: in docs -- https://master.php.net/note/delete/104983/in+docs Del: other reasons-- https://master.php.net/note/delete/104983 Reject -- https://master.php.net/note/reject/104983 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181722) next »