note 106890 added to function.define
| From: | metrox at cityz dot com | Date: | Fri, 16 Dec 2011 04:16:55 +0000 |
| Subject: | note 106890 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185083@lists.php.net to get a copy of this message | ||
- About <?php if(CONST_DEFINED) ... ?> you should have use
<?php if (defined(CONST_DEFINED)) ... ?> or <?php if (CONST_DEFINED === true) ... ?>
as by default CONST_DEFINED value is "CONST_DEFINED" which is not false
- About "integers starting with 0 won't work" please
see http://www.php.net/manual/fr/language.types.integer.php
as 09900 is not a valid number
- About "redeclare define - it is possible" you are wrong.
<?php define('TEST','foo',true); ?> is the same as <?php
define('test','foo'); ?>,
but "TEST" and "test" are two different constants.
- About constant name you can use nearly anything and access your constant using constant() :
<?php
define('anything:()$ as a name :)', 'crazy name');
echo constant('anything:()$ as a name :)');
?> ;)
----
Server IP: 69.147.83.197
Probable Submitter: 180.183.214.14
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- https://master.php.net/note/edit/106890
Del: integrated -- https://master.php.net/note/delete/106890/integrated
Del: useless -- https://master.php.net/note/delete/106890/useless
Del: bad code -- https://master.php.net/note/delete/106890/bad+code
Del: spam -- https://master.php.net/note/delete/106890/spam
Del: non-english -- https://master.php.net/note/delete/106890/non-english
Del: in docs -- https://master.php.net/note/delete/106890/in+docs
Del: other reasons-- https://master.php.net/note/delete/106890
Reject -- https://master.php.net/note/reject/106890
Search -- https://master.php.net/manage/user-notes.php