PHP syntax: iterate over an associative array
An associative array stores an arbitrary index in addition to the values. This is useful for storing configuration information such as in the $_SERVER array.
An individual element of this array can be retrieved with:
$_SERVER['SITE_HTMLROOT']
To loop through all of the elements in $_SERVER and display the values and their corresponding indexes:
foreach ( $_SERVER as $ind=>$val )
echo "$ind : $val
“;






Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment