Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

PHP array_unshift() example

array_unshift — Prepend one or more Elements to the beginning of an array.

array_unshift() prepends passed elements to the front of the array. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won’t be changed.

Example #1 array_unshift() example


The above example will output:

Array
(
    [0] => apple
    [1] => raspberry
    [2] => orange
    [3] => banana
)

The post PHP array_unshift() example appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

PHP array_unshift() example

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×