note 114925 added to function.constant
| From: | Anonymous | Date: | Mon, 28 Apr 2014 08:53:27 +0000 |
| Subject: | note 114925 added to function.constant | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199342@lists.php.net to get a copy of this message | ||
Note that constant may be interpreted as a string if you pass it directly, use
constant('CONSTANT_NAME') to force using it's value.
function dosmth($string)
{
echo "This is '".$string."'<br>";
}
define('ABC', 'hello world');
dosmth(ABC);
dosmth(ABCD);
dosmth(constant(ABCD));
Output:
This is 'hello world'
This is 'ABCD'
Warning: constant(): Couldn't find constant ABCD in
/home/stelshevskis/public_html/analytics/common.php on line 12 This is ''
----
Server IP: 72.52.91.14
Probable Submitter: 91.90.249.76
----
Manual Page -- http://php.net/manual/en/function.constant.php
Edit -- https://master.php.net/note/edit/114925
Del: integrated -- https://master.php.net/note/delete/114925/integrated
Del: useless -- https://master.php.net/note/delete/114925/useless
Del: bad code -- https://master.php.net/note/delete/114925/bad+code
Del: spam -- https://master.php.net/note/delete/114925/spam
Del: non-english -- https://master.php.net/note/delete/114925/non-english
Del: in docs -- https://master.php.net/note/delete/114925/in+docs
Del: other reasons-- https://master.php.net/note/delete/114925
Reject -- https://master.php.net/note/reject/114925
Search -- https://master.php.net/manage/user-notes.php