Answers for "php array_unshift"

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
1

unshift in php

<?php
	$a=array("a"=>"red","b"=>"green");
	array_unshift($a,"blue");
	print_r($a);
// result : Array ( [0] => blue [a] => red [b] => green )

?>
Posted by: Guest on May-12-2021
1

array unshift php

<?php

 $a=array("a"=>"red","b"=>"green");
array_unshift($a,"blue");
print_r($a);

?>
Posted by: Guest on March-29-2021
0

array_unshift

$cola = array("naranja", "banana");
array_unshift($cola, "manzana", "frambuesa");
print_r($cola);

Array
(
    [0] => manzana
    [1] => frambuesa
    [2] => naranja
    [3] => banana
)
Posted by: Guest on June-11-2021

Browse Popular Code Answers by Language