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 (  => The Beatles  => Simon and Garfunkel  => The Doors  => Dire Straits ) Two new values are added at the beginning of the
array_shift function is used to shift or remove the first value of an array. Here’s an example : Output will look like this : Array (  => The Doors  => Dire Straits  => Simon and Garfunkel ) The first value from the array is removed. You can assign the removed value to
array_pop function pops or removes the last value of an array. It’s used to shorten any array. Let’s see how this works. Output will look like this : Array (  => The Beatles  => The Doors  => Dire Straits ) Here array_pop() function removed the last value of the array.
array_push() is used to push or add values into an array. This function treats the array as a pile or stack and pushes the values onto the end of the array. For example : Here, first we declared an array with some colors. Then with the array_push() function we added two more values to the