note 41120 added to function.array-pop

From: Date: Tue, 30 Mar 2004 18:55:05 +0000
Subject: note 41120 added to function.array-pop
Groups: php.notes 
Request: Send a blank email to php-notes+get-67394@lists.php.net to get a copy of this message
A function to delete an array value that recalculates the index ( its very short and easy to understand ). Hope this might help someone... <?php /* Usage: $array : Array $indey : Integer The value of $array at the index $index will be deleted by the function. */ function array_trim ( $array, $index ) { if ( is_array ( $array ) ) { unset ( $array[$index] ); array_unshift ( $array, array_shift ( $array ) ); return $array; } else { return false; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-pop.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41120 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41120&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41120&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67394) next »