This PHP program demonstrates how to print all of the defined constants.
<?php // Two user-defined constants define("TRINITY", 3); define("APOSTLES", 12); $saaConstants = get_defined_constants(true); // Loop over each set of constants foreach($saaConstants as $sCategory => $saConstants) { // Make the category heading for each group of constants echo "<ul><h3>".$sCategory."</h3>"; // Loop over the constants in the group foreach($saConstants as $sKey =>$sConstant) { echo "<li>".$sKey." => ".$sConstant."</li>"; } echo "</ul>"; } ?>
© 20072024 XoaX.net LLC. All rights reserved.