What is the purpose of using array_shift in the given PHP code?
The purpose of using array_shift in the given PHP code is to remove the first element from an array and return it. This can be useful if you need to process elements in an array one by one, starting from the first element.
// Given PHP code with array_shift
$fruits = ["apple", "banana", "orange"];
$first_fruit = array_shift($fruits);
echo "First fruit: " . $first_fruit . "\n";
echo "Remaining fruits: " . implode(", ", $fruits);