PHP HOW TO ADD MULTIPLE VALUES INTO AN ARRAY USING ARRAY_PUSH

How to Push Multiple Elements into an Array using array_push()

You might have come to a situation where you need to add more than one element into an array using array_push. Array_push() treats array as a stack and pushes the added element into the end of the array. Array increases with number of variables pushed.

General Syntax of array_push()

<?php
     array_push ( array $array [, mixed $... ] );
?>

How to push multiple elements into array using array push

This is how to add multiple variables into an array;

<?php
     array_push($array, $variable1, $variable2, $variable3.......);
?>

With array push, you can add as many values as you wish.






AdBlock Detected!
This site depends on revenue from ad impressions to survive. If you find this site valuable, please consider disabling your ad blocker or pausing adblock for this website.