note 32826 deleted from function.array-pop by crell

From: Date: Tue, 12 Apr 2022 01:08:10 +0000
Subject: note 32826 deleted from function.array-pop by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218209@lists.php.net to get a copy of this message
Note Submitter: ryan8613(at)hotmail(dot)com ---- A function that may help some out, considering it's pretty much the one mentioned previously... <?php function array_trim($arr, $indice) { if(!isset($indice)) { $indice = count($arr)-1; } unset($arr[$indice]); array_shift($arr); return $arr; } ?> It cuts the given index value off of the array, but without the shift, if the 'index' value isn't given, it cuts off the end value.

« previous php.notes (#218209) next »