How can array_shift() be used to retrieve the first element of an array in PHP when including multiple pages?

When including multiple pages in PHP, the array_shift() function can be used to retrieve the first element of an array. This is useful when you have an array containing data that you want to access on different pages. By using array_shift(), you can extract the first element of the array without modifying the original array, allowing you to access the data sequentially as you include different pages.

<?php
// Define an array with some data
$data = array("First", "Second", "Third");

// Include multiple pages
include 'page1.php';
include 'page2.php';

// Retrieve the first element of the array using array_shift()
$firstElement = array_shift($data);

// Use the $firstElement variable in the included pages
?>