note 105559 added to language.constants
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 27 Aug 2011 14:35:45 +0000 |
| Subject: | note 105559 added to language.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182767@lists.php.net to get a copy of this message | ||
PHP will allow characters other than those shown for both variable names and constants, and
therefore probably functin names, too. And I'm pretty sure array indexes also.
Many others are allowed, while some are not. It seems like a craps-shoot at first, but there is a
'bit' of reason...
you can do this:
<?php
$x´; // using the "acute (reverse) accent mark" (#182)
?>
but not:
<?php
$xâ²; // using the "prime mark" (#8242)
?>
but you can do:
<?php
$xâ¡â ±â2ÃÏ // using double dagger, dagger, plus-minus, square-root, the
number 2, the "times symbol" and the greek letter pi (lowercase).
?>
but not:
<?php
$xââââ; // using male, female, lozenge, mathematical increment symbol.
?>
You can do this:
<?php
define('âPI', M_PI); // 180 degrees = Ï radians â 3.141592654
radians
define('â180°', M_PI);
define('âPI÷2', M_PI_2); // 90 degrees â 1.570796327 radians
define('â90°', M_PI_2);
define('âPI÷4', M_PI_4); // 45 degrees â 0.785398163 radians
define('â45°', M_PI_4);
define('âPIÃ3÷2', âPI+âPI÷2); // 270 degrees â 4.71238898
radians
define('â270°', âPIÃ3÷2);
define('âPIÃ2', âPI*2); // 360 degrees = 2Ï radians â
6.283185307 radians
define('â360°', âPIÃ2);
?>
So essentially, you must check each character for acceptance by PHP if you want to use them, but
they can really add a semantical value in some cases, thus making your code easier to read and
understand..
----
Server IP: 69.147.83.197
Probable Submitter: 74.160.228.23
----
Manual Page -- http://www.php.net/manual/en/language.constants.php
Edit -- https://master.php.net/note/edit/105559
Del: integrated -- https://master.php.net/note/delete/105559/integrated
Del: useless -- https://master.php.net/note/delete/105559/useless
Del: bad code -- https://master.php.net/note/delete/105559/bad+code
Del: spam -- https://master.php.net/note/delete/105559/spam
Del: non-english -- https://master.php.net/note/delete/105559/non-english
Del: in docs -- https://master.php.net/note/delete/105559/in+docs
Del: other reasons-- https://master.php.net/note/delete/105559
Reject -- https://master.php.net/note/reject/105559
Search -- https://master.php.net/manage/user-notes.php