Answers for "Push an object at first index of an array php"

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 "Push an object at first index of an array php"

Browse Popular Code Answers by Language