note 116868 added to language.operators.arithmetic
| From: | HayleyWatson | Date: | Thu, 12 Mar 2015 22:36:27 +0000 |
| Subject: | note 116868 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201930@lists.php.net to get a copy of this message | ||
Not mentioned is the unary + operator, which is equivalent to adding its operand to zero. When
applied to a number it has no effect, but to other types it has the effect of converting the value
to an integer or double, whichever is more appropriate for the value and according to the usual type
juggling rules.
<?php
echo gettype(+'76777.5'); // outputs "double"
echo gettype(+'767775'); // outputs "integer"
?>
----
Server IP: 72.52.91.14
Probable Submitter: 125.238.146.34
----
Manual Page -- http://php.net/manual/en/language.operators.arithmetic.php
Edit -- https://master.php.net/note/edit/116868
Del: integrated -- https://master.php.net/note/delete/116868/integrated
Del: useless -- https://master.php.net/note/delete/116868/useless
Del: bad code -- https://master.php.net/note/delete/116868/bad+code
Del: spam -- https://master.php.net/note/delete/116868/spam
Del: non-english -- https://master.php.net/note/delete/116868/non-english
Del: in docs -- https://master.php.net/note/delete/116868/in+docs
Del: other reasons-- https://master.php.net/note/delete/116868
Reject -- https://master.php.net/note/reject/116868
Search -- https://master.php.net/manage/user-notes.php