In this tutorial we will learn how to remove first element from array in PHP.
Here we will take two example single dimensional array and multi dimensional array from which we remove first element from array in PHP using array_shift() function.
1) Remove first element from single dimensiona array in PHP.
<?php
$Arrays = ["w3school", "teknowize", "tutorialpoint"];
array_shift($Arrays);
echo "<pre>";
print_r($Arrays);
?>
Output
2) Remove first element from multi dimensional array in PHP.
<?php
$online_tutorial = [
[ "id" => 1, "website" => "w3school"],
[ "id" => 2, "website" => "teknowize"],
[ "id" => 3, "website" => "tutorialpoint"],
];
array_shift($online_tutorial);
echo "<pre>";
print_r($online_tutorial);
?>
Output