php array move first element to last
$array = array("PHP", "JS", "JAVA");
$first_element = array_shift($array);
$array[count($array) + 1] = $first_element;
print_r($array);
php array move first element to last
$array = array("PHP", "JS", "JAVA");
$first_element = array_shift($array);
$array[count($array) + 1] = $first_element;
print_r($array);
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 }
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us