Specifications

$string .= “ }”;
}
return $string;
}
else
{
// if it is not an array, just return it
return $array;
}
}
?>
This code will iterate through four arrays of variables that a page receives. If a page was called
with GET variables, POST variables, cookies, or has session variables, these will be output.
A line of HTML will be generated for each type of variable.
The lines will resemble this:
<!-- { var1 = ‘value1’, var2 = ‘value2’, var3 = ‘value3’ } -->
We have put the output within an HTML comment so that it is viewable, but will not interfere
with the way that the browser renders visible page elements. This is a good way to generate
debugging information.
The exact output will depend on the variables passed to the page, but when added to Listing
20.4, one of the authentication examples from Chapter 20, Using Session Control in PHP,it
adds the following lines to the HTML generated by the script:
<!-- BEGIN VARIABLE DUMP -->
<!-- BEGIN GET VARS -->
<!-- -->
<!-- BEGIN POST VARS -->
<!-- { userid = testuser, password = test123 } -->
<!-- BEGIN SESSION VARS -->
<!-- { valid_user = testuser } -->
<!-- BEGIN COOKIE VARS -->
<!-- { PHPSESSID = 2552dc82bb465af56d65e9300f75fd68 } -->
<!-- END VARIABLE DUMP -->
You can see that it is displaying the POST variables sent from the login form on the previous
pageuserid and password. It is also showing the session variable that we are using to keep
Building Practical PHP and MySQL Projects
P
ART V
488
LISTING 23.1 Continued
29 7842 CH23 3/6/01 3:41 PM Page 488