note 53635 added to function.array-pop

From: Date: Tue, 07 Jun 2005 21:03:58 +0000
Subject: note 53635 added to function.array-pop
Groups: php.notes 
Request: Send a blank email to php-notes+get-90088@lists.php.net to get a copy of this message
In a previous example ... <?php function array_trim ( $array, $index ) { if ( is_array ( $array ) ) { unset ( $array[$index] ); array_unshift ( $array, array_shift ( $array ) ); return $array; } else { return false; } } ?> This have a problem. if u unset the last value and then use <? array_unshift ( $array, array_shift ( $array ) ); ?> will return a : Array ( [0] => ) so u can fix it using... <?php if (count($array) > 0) array_unshift ( $values, array_shift ( $values ) ); ?> good luck ;) ---- Manual Page -- http://www.php.net/manual/en/function.array-pop.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53635 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53635&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53635&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53635&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53635&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53635&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53635&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90088) next »