note 107164 added to language.constants.syntax
| From: | timucinbahsi at gmail dot com | Date: | Wed, 11 Jan 2012 18:23:30 +0000 |
| Subject: | note 107164 added to language.constants.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185588@lists.php.net to get a copy of this message | ||
Constant names shouldn't include operators. Otherwise php doesn't take them as part of the
constant name and tries to evaluate them:
<?php
define("SALARY-WORK",0.02); // set the proportion
$salary=SALARY-WORK*$work; // tries to subtract WORK times $work from SALARY
?>
----
Server IP: 69.147.83.197
Probable Submitter: 46.197.2.248
----
Manual Page -- http://www.php.net/manual/en/language.constants.syntax.php
Edit -- https://master.php.net/note/edit/107164
Del: integrated -- https://master.php.net/note/delete/107164/integrated
Del: useless -- https://master.php.net/note/delete/107164/useless
Del: bad code -- https://master.php.net/note/delete/107164/bad+code
Del: spam -- https://master.php.net/note/delete/107164/spam
Del: non-english -- https://master.php.net/note/delete/107164/non-english
Del: in docs -- https://master.php.net/note/delete/107164/in+docs
Del: other reasons-- https://master.php.net/note/delete/107164
Reject -- https://master.php.net/note/reject/107164
Search -- https://master.php.net/manage/user-notes.php