Answers for "cut first index of array and add it in php"

PHP
5

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
0

php move element to beginning of array

$array = array("JS", "JAVA");
array_unshift($array, "PHP");
print_r($array);
// Add More Than One Element
$array1 = array("JS", "JAVA");
array_unshift($array1, "PHP", "CSS", "HTML");
print_r($array1); // => { PHP CSS HTML JS JAVA }
Posted by: Guest on June-09-2021

Code answers related to "cut first index of array and add it in php"

Browse Popular Code Answers by Language