PHP array_unshift() functionThe array_unshift( ) function is an inbuilt function of PHP. It is used to add one or more elements to the beginning of an array. This function was introduced in PHP 4.0. SyntaxParameters
Return ValuesThe array_unshift( ) function returns the new number of elements in the array. Important note:All numerical array keys will be modified to start counting from zero while literal keys won't be changed. Example 1Output: 1 2 3 java t point Example 2Output: Array ( [0] =>sachin [1] =>sehwag [2] =>harbhajan [3] =>virat [4] =>rohit [5] =>pandeya ) Example 3Output: Array ( [0] =>leneovo [1] =>acer [2] => dell [3] =>hp) Example 4Output: Array ( [0] =>pune [1] =>kolkata [2] =>bangalore [3] =>delhi )
Next TopicPHP Array Functions
|