6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHP7調査(8)16進数が数値文字列として扱われなくなる

Last updated at Posted at 2015-04-11

PHP7から16進文字列が数値文字列として扱われなくなります。これにより、==の挙動が変わったりします。

<?php
var_dump("0x10"=="16"); // PHP5: true, PHP7: false
var_dump(is_numeric("0x10")); // PHP5: true, PHP7: false

もともと誰も得しない仕様だったので、「今さら変えるなよ!」ってこと以外は特に問題ないように思います。

ちなみに、「1.2e3」のような浮動小数点数の指数表記は今まで通り数値文字列とみなされます。片手落ちな気もしますね…。

参照

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?