note 103810 added to function.define
| From: | bdavis at cove-mtn dot com | Date: | Wed, 04 May 2011 17:54:25 +0000 |
| Subject: | note 103810 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179428@lists.php.net to get a copy of this message | ||
>>Something I found out the "hard" way today: integers starting with 0 won't
>>work.
Integers starting with a 0 are octal and do work. The example included 9s and so failed parsing.
>>Constant name must not written as string. The following code works also:
Constant names not written as strings will produce warnings in your error log because evaluating a
constant to get a name is legal.
<?php
define("FOO", "bar");
define("SC", 0777);
define(FOO, 1232); // this is the same as define("bar", 1232);
var_dump(SC); // prints 511
var_dump(bar); // prints 1232
?>
----
Server IP: 208.69.120.55
Probable Submitter: 168.103.182.71
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- https://master.php.net/note/edit/103810
Del: integrated -- https://master.php.net/note/delete/103810/integrated
Del: useless -- https://master.php.net/note/delete/103810/useless
Del: bad code -- https://master.php.net/note/delete/103810/bad+code
Del: spam -- https://master.php.net/note/delete/103810/spam
Del: non-english -- https://master.php.net/note/delete/103810/non-english
Del: in docs -- https://master.php.net/note/delete/103810/in+docs
Del: other reasons-- https://master.php.net/note/delete/103810
Reject -- https://master.php.net/note/reject/103810
Search -- https://master.php.net/manage/user-notes.php