note 90234 added to userlandnaming
| From: | clancyhoodatgmaildotcom at osu1 dot php dot net | Date: | Sat, 11 Apr 2009 17:15:38 +0000 |
| Subject: | note 90234 added to userlandnaming | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153089@lists.php.net to get a copy of this message | ||
The specified permitted characters in variable names (including the first character) are somewhat
more permissive than you might expect.
The specified regex is [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* (from ./functions.user-defined.php)
On running the following you can see those outside of [a-zA-Z0-9_] that work. Your browser/shell may
not display all properly, and some editors (I tested in Textmate) may simply remove things it
doesn't grok as whitespace. However, there are some pretty sexy characters in there should you
be looking for a unique namespace which is not too lengthy. Using them can be inconvenient for
others who may not have a suitable keyboard for single-stroke entry (mine is Spanish). Best used for
a program's internally relevant methods - which are those we wish least to pollute a namespace.
<?
header('Content-type:text/plain; charset=utf-8');
function unichr($u) {
return mb_convert_encoding('&#'.intval($u).';', 'UTF-8',
'HTML-ENTITIES');
}
for($i = hexdec("7f"); $i <= hexdec("ff"); $i++) echo
unichr($i)."\n";
// simple example
function ñ(){
echo "I'm ok!";
}
ñ();
?>
----
Server IP: 80.64.47.13
Probable Submitter: 87.221.113.218
----
Manual Page -- http://www.php.net/manual/en/userlandnaming.php
Edit -- https://master.php.net/note/edit/90234
Del: integrated -- https://master.php.net/note/delete/90234/integrated
Del: useless -- https://master.php.net/note/delete/90234/useless
Del: bad code -- https://master.php.net/note/delete/90234/bad+code
Del: spam -- https://master.php.net/note/delete/90234/spam
Del: non-english -- https://master.php.net/note/delete/90234/non-english
Del: in docs -- https://master.php.net/note/delete/90234/in+docs
Del: other reasons-- https://master.php.net/note/delete/90234
Reject -- https://master.php.net/note/reject/90234
Search -- https://master.php.net/manage/user-notes.php