PHP Array Exercises : Inserts a new item in an array in any position
Write a PHP script that inserts a new item in an array in any position.
Sample Solution:
PHP Code:
Output:
Original array : 1 2 3 4 5 After inserting '$' the array is : 1 2 3 $ 4 5
Flowchart:

PHP Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a PHP script which decodes the specified JSON string.
Next: Write a PHP script to sort the specified associative array
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.