Req #67837 [Com]: Allow cast to (number)
| From: | datibbaw@php.net | Date: | Thu, 14 Aug 2014 05:49:38 +0000 |
| Subject: | Req #67837 [Com]: Allow cast to (number) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187114@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67837&edit=1
ID: 67837
Comment by: datibbaw@php.net
Reported by: lkmorlan at uwaterloo dot ca
Summary: Allow cast to (number)
Status: Open
Type: Feature/Change Request
Package: Variables related
Operating System: all
PHP Version: 5.6.0RC3
Block user comment: N
Private report: N
New Comment:
Alternatively, you can currently accomplish this with a unary +:
$number = +$var;
Previous Comments:
------------------------------------------------------------------------
[2014-08-13 18:52:22] lkmorlan at uwaterloo dot ca
Description:
------------
It would be useful to have the ability to cast to (number), which would cast to either (int) or
(float), as needed.
(number) $var;
Would be the same as:
$var += 0;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67837&edit=1