Mega Code Archive

 
Categories / Php / Functions
 

Define constant in a function

<?php define('CONST1', 1); function MyTest() {   define('CONST2', 2); } MyTest(); echo "CONST1 = " . CONST1 . " and CONST2 = " . CONST2 . "\n"; ?>