Get and remove first element of an array in PHP -
hi coding system in need function , remove first element of array. array has numbers i.e.
0,1,2,3,4,5
how can loop through array , each pass value , remove array @ end of 5 rounds array empty.
thanks in advance
you might try using foreach/unset, instead of array_shift.
$array = array(0, 1, 2, 3, 4, 5); foreach($array $value) { // each pass value // use method dosomethingwithvalue($value); echo $value; // , remove array unset($array[$value]); } //so @ end of 6 rounds array empty assert('empty($array) /* array must empty. */'); ?>
Comments
Post a Comment