Answers for "php add element to array at the beginning"

PHP
4

php add element to array first position

<?php
$queue = array("orange", "banana");
array_unshift($queue, "apple", "raspberry");
print_r($queue);
?>
  Array
(
    [0] => apple
    [1] => raspberry
    [2] => orange
    [3] => banana
)
Posted by: Guest on August-13-2020

Code answers related to "php add element to array at the beginning"

Browse Popular Code Answers by Language