note 118836 added to function.define

From: Date: Sat, 13 Feb 2016 11:35:41 +0000
Subject: note 118836 added to function.define
Groups: php.notes 
Request: Send a blank email to php-notes+get-204936@lists.php.net to get a copy of this message
I think worth mentioning is that define() appears to ignore invalid constant names. One immediate implication of this seem to be that if you use an invalid constant name you have to use constant() to access it and obviously that you can't use the return value from define() to tell you whether the constant name used is invalid or not. For example: $name = '7(/!§%'; var_dump(define($name, "hello")); // outputs bool(true) var_dump(constant($name)); // outputs string(5) "hello" ---- Server IP: 72.52.91.14 Probable Submitter: 37.48.74.50 ---- Manual Page -- http://php.net/manual/en/function.define.php Edit -- https://master.php.net/note/edit/118836 Del: integrated -- https://master.php.net/note/delete/118836/integrated Del: useless -- https://master.php.net/note/delete/118836/useless Del: bad code -- https://master.php.net/note/delete/118836/bad+code Del: spam -- https://master.php.net/note/delete/118836/spam Del: non-english -- https://master.php.net/note/delete/118836/non-english Del: in docs -- https://master.php.net/note/delete/118836/in+docs Del: other reasons-- https://master.php.net/note/delete/118836 Reject -- https://master.php.net/note/reject/118836 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204936) next »