note 20874 added to control-structures.foreach

From: Date: Fri, 19 Apr 2002 21:38:18 +0000
Subject: note 20874 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-29582@lists.php.net to get a copy of this message
Best way I know of to remove an element from an array and have everything shift automatically is: $arr= array(9,8,7,6,5,4,3,2,1); $remove_index = 1; array_splice($arr, $remove_index, array_slice($arr, $remove_index +1)); You’d thing there would be a function that does this automatically. If there is a better way then please let me know at: mad_d_man@yahoo.com -- http://www.php.net/manual/en/control-structures.foreach.php http://master.php.net/manage/user-notes.php?action=edit+20874 http://master.php.net/manage/user-notes.php?action=delete+20874 http://master.php.net/manage/user-notes.php?action=reject+20874

« previous php.notes (#29582) next »