Are arrays in PHP considered global variables by default?
Arrays in PHP are not considered global variables by default. If you want to access an array globally within your PHP script, you can declare it as a global variable using the `global` keyword. This allows you to access and modify the array from any function within your script.
<?php
// Define an array globally
global $myArray;
$myArray = array('apple', 'banana', 'cherry');
function addToMyArray($item) {
global $myArray;
array_push($myArray, $item);
}
// Add an item to the global array
addToMyArray('date');
// Print the global array
print_r($myArray);
?>