> for ($i=$elpos; $i<count($array); $i++) {
>     $array[$i] = $array[$i+1];
> }
> unset($array[count($array)-1]);


I found another possible solution, which should be more
performant than the one above:

$input = array ("a", "b", "c", "d", "e");
print_r($input);
$offset = 2;
$array1 = array_splice($input, 0, $offset);
$array2 = array_splice($input, $offset-1);
$input = array_merge($array1, $array2);
print_r($input);

Results in output of:
Array ( [0] => a [1] => b [2] => c [3] => d [4] => e )
Array ( [0] => a [1] => b [2] => d [3] => e )

--
 Dennis Sterzenbach
 www.darknoise.de

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to