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.
My name is Benson Karue, I was Software Engineer Telenet Co LTD before I quit and joined YouTube and Udemy as an instructor. I have real-world software experience and have a Bachelor’s degree in Mathematics and Computer Science with 6+ years of coding experience and winning several competitions and coding challenges.