Define constant in a function : Definition « Functions « PHP
- PHP
- Functions
- Definition
Define constant in a function
<?php
define('CONST1', 1);
function MyTest() {
define('CONST2', 2);
}
MyTest();
echo "CONST1 = " . CONST1 . " and CONST2 = " . CONST2 . "\n";
?>
Related examples in the same category