PHP array_slice() functionThe array_slice() function is an inbuilt function of PHP. The array_slice() function is used to extract a slice of an array. This function was introduced in 4.0. SyntaxParameters
ReturnThe array_slice( ) function returns the selected parts of an array. If the offset is larger than the size of the array, this function will return an empty array. Example 1Output: Array ( [0] =>sehwag [1] =>rahul ) Example 2Output: Array ( [0] => Hyundai [1] => Toyota ) Example 3Output: Array ( [2] => Hyundai [3] => Toyota ) Example 4Output: Array ( [0] => DBMS ) Array ( [0] =>os ) Array ( [0] => java [1] => C++ [2] =>os [3] => DBMS )
Next TopicPHP Array Functions
|