I created an array outside of an functions, which means it should have global scope. I then try to loop through it from within a function, which should have access to the globally created array, but it throws an error when I attempt to do so.
$form_fields = array(
    'name',
    'locality',
    'url_slug',
    'address');
function step_1() {
    foreach($form_fields as $field) {
        echo $field . '<br />';
    }
}
step_1();
I am receiving the following error:
Undefined variable: form_fields -- at line 10
I would like to avoid using the global keyword or having to add the array as an argument for the function as I only want to read the array and not change it.
How can I access the globally created $form_fields array from within the step_1() function?
 
     
    