note 61710 added to function.array-splice

From: Date: Fri, 10 Feb 2006 03:35:37 +0000
Subject: note 61710 added to function.array-splice
Groups: php.notes 
Request: Send a blank email to php-notes+get-103405@lists.php.net to get a copy of this message
For anybody who is wondering... jrhardytwothousandtwo's trick for inserting an element using array_splice, will also work with multi-dimensional arrays if you do the following: <?php function array_insert(&$input, $offset, $replacement){ array_splice($input, $offset, 0, 0); $input[$offset] = $replacement; } ?> I'm not sure if this (or a derivative of it) will solve other problems that I have seen just about everybody on here trying to solve. But apart from it's hackish nature, it works well for me. ---- Server IP: 203.16.234.20 Probable Submitter: 202.89.183.43 ---- Manual Page -- http://www.php.net/manual/en/function.array-splice.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61710 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61710&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61710&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103405) next »