array_push (arrName, varName) function in php

Example of array_push() function
Example of array_push() function

array_push() function use an array as a stack, and it pushes the passed variables at the end of the array. The length of the array increases automatically by the number of variables pushed into the array_push function. It accepts two parameters, the first parameter to be an array and the second parameter can be any type of value.

array_push : Point To be remembered:

array_push() function() create a warning if the first argument passed in array_push is not an array.

Example :


Output of array_push() function example
Output of array_push() function example

About the author

Dinesh Sharma

I have worked on many CMS & Frameworks of PHP & I love to share my knowledge of what I am learning every day.

Add Comment

Click here to post a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.