Answers for "php move an array element to the top"

PHP
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
0

php move index of a value to first position in array

//appending $new in our array 
array_unshift($arr, $new);
//now make it unique.
$final = array_unique($arr);
Posted by: Guest on May-20-2021

Code answers related to "php move an array element to the top"

Browse Popular Code Answers by Language