Quantcast
Channel: Remi's RPM repository - Blog - Mot-clé - planet-php
Viewing all articles
Browse latest Browse all 25

PHP 7.1 and number check

$
0
0

PHP 7.1 introduce a new check during conversion of string to number.

Example :

$ module load php70
$ php -v
PHP 7.0.8RC1 (cli) (built: Jun  8 2016 06:25:44) ( NTS )
$ php -r 'var_dump("1K" * 1024);'
int(1024)

$ module load php71
$ php -v
PHP 7.1.0alpha1 (cli) (built: Jun  8 2016 09:36:05) ( NTS )
$ php -r 'var_dump("1K" * 1024);'
PHP Notice:  A non well formed numeric value encountered in Command line code on line 1
int(1024)

See it on 3v4l.org.

It is obvious that this new message is useful, but such code is very common.

Some examples in real projects:

You can start checking your code ;)


Viewing all articles
Browse latest Browse all 25

Trending Articles