PHP array_splice() functionThe array_splice() function is an extended version of array_slice() function. The array_splice() function removes selected elements from an array and replaces it with new elements. This function was introduced in PHP 4. SyntaxParameters
Return ValuesThe array_splice( ) function returns an array which consists of the extracted elements. Important note:If offset and length are such that nothing is removed, then the elements from the replacement array are inserted in the place specified by the offset. The keys in the replaced array are not preserved. Example 1Output: Array ( [0] =>AbhinavBindra [1] =>Sushilkumar ) Example 2Output: Array ( [0] =>AbhinavBindra [1] => Mary kom ) Example 3Output: Array ( [0] =>AbhinavBindra [1] =>Vijendersingh ) Example 4Output: Array ( [a] => apple [b] => banana )
Next TopicPHP Array Functions
|