array_slice Tutorials

array_slice

Syntax: array array_slice ( array $array , int $offset [, int $length = NULL [, bool $preserve_keys = false ]] ) Description:Extract a slice of the array <?php $input = array("a", "b", "c", "d", "e"); $output = array_slice($input, 2); print_r($output );echo "<br/>"; $output = array_slice($input, -2, 1); print_r($output );echo "<br/>"; $output = array_slice($input, 0, 3); print_r($output ); ?> OUTPUT Array ( [0] => c [1] => d [2] => e […]... Read More »