Can I also use "asterisk*" or "escape\" for PHP function names?
For example, is a function name like fetch_*_id OK?
The function name follows the same rules as the other labels in PHP.Valid forms of function names begin with letters or underscores followed by any number of letters, numbers, or underscores.The regular expression is ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$.
I think it would be faster to actually try it myself...
In UNIXODE, *
is U+002A
and \
is U+005C
in UTF-8 notation, which means \x2A
or \x5C
, but does not include the regular expression [a-zA_Z\x80]
.
The full-width asterisk *
is \xEF\xBC\x8A
in the U+FF0A
UTF-8 notation, which is included in the previous regular expression, so OK
<?php function f*o() {echo sha1("abc");}
f*o()?>
was successful.
Not sure if it matches the user-level naming guide, but it's a good idea not to use this kind of (so-called) full-width characters as they cause religious wars.
© 2024 OneMinuteCode. All rights reserved.