How to use array_unshift() Function in PHP

array_unshift function is used to add one or more values at the beginning of an array.

Let’s see how this works:

Here’s the output :

Array ( [0] => The Beatles [1] => Simon and Garfunkel [2] => The Doors [3] => Dire Straits )

Two new values are added at the beginning of the array.

Sharing is Caring
Imtiaz Rayhan
 

WordPress Enthusiast, Novice PHP Developer. Music Addict, The Beatles Fan. Conncect with me on Facebook, Google+ and Twitter.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: