Req #67837 [Com]: Allow cast to (number)

From: Date: Sun, 09 Sep 2018 00:52:23 +0000
Subject: Req #67837 [Com]: Allow cast to (number)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216938@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: carusogabriel@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: A number cast would be useful to convert, for example, binary bases, which today isn't possible using +, (int) or (float) before the variable: https://3v4l.org/kspcM Previous Comments: ------------------------------------------------------------------------ [2014-08-14 05:49:38] datibbaw@php.net Alternatively, you can currently accomplish this with a unary +: $number = +$var; ------------------------------------------------------------------------ [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

« previous php.bugs (#216938) next »