note 89513 modified in function.define by danbrown

From: Date: Thu, 12 Mar 2009 01:25:22 +0000
Subject: note 89513 modified in function.define by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151749@lists.php.net to get a copy of this message
In PHP 4.4.9, you cannot use certain names for constants. Specifically, reserved words such as 'PRINT', 'IF', etc. Oddly enough, you get different behaviour for some: <?php define('IF', 42); echo "IF: ", IF, "<hr />\n"; ?> yields PHP Parse error: syntax error, unexpected T_IF <?php define('PRINT', 13); echo "PRINT: ", PRINT, "<hr />\n"; ?> yields PHP Parse error: syntax error, unexpected ')' Not sure if this is still true in PHP 5 or not, but it's worth noting if it is. --was-- In PHP 4.4.9, you cannot use certain names for constants. Specifically, reserved words such as 'PRINT', 'IF', etc. Oddly enough, you get different behaviour for some: define('IF', 42); echo "IF: ", IF, "<hr />\n"; yields PHP Parse error: syntax error, unexpected T_IF define('PRINT', 13); echo "PRINT: ", PRINT, "<hr />\n"; yields PHP Parse error: syntax error, unexpected ')' Not sure if this is still true in PHP 5 or not, but it's worth noting if it is. http://php.net/manual/en/function.define.php

« previous php.notes (#151749) next »