ARRAY SLICE PHP FUNTION
Views: 242
array_slice php, funtion to extract a slice from array
Formula
array array_slice ( array $array , int $offset [, int $length [, bool $preserve_keys = false ]] )
Example of array slice :
<?php
$input_array = array("Apple", "Banana", "Cherry", "Dragonfruit", "Grapefruit");
$output_result = array_slice($input, 2); # result "Cherry", "Dragonfruit", and "Grapefruit"
$output_result = array_slice($input, -2, 1); # result "Dragonfruit"
$output_result = array_slice($input, 0, 4); # result "Apple", "Banana", "Cherry", and "Dragonfruit"
?>
|
|