34,333
edits
Changes
→Functions and Variable Scope
Clearly this will be a problem if you ever need to access a global variable in a function with a conflicting local variable name. Fortynately PHP provides the ''GLOBALS'' array which provides access to all global variables from within functions. If, therefore, we wanted to access the global version of $myString from within the ''showString()'' we could modify our script as follows:
<pre>
<?php
function showString ()