r/programming • • Dec 02 '15

PHP 7 Released

https://github.com/php/php-src/releases/tag/php-7.0.0
887 Upvotes

729 comments sorted by

View all comments

Show parent comments

28

u/NeuroXc Dec 02 '15

Mostly.

"34" != "34 " and " 34" != "34 ".

But "34" == " 34".

Wat.

3

u/alexanderpas Dec 02 '15

2

u/greyfade Dec 02 '15

This is one of PHP's more annoying issues. When comparing two values that are strings, they should not be converted to ints just because they can be.

2

u/alexanderpas Dec 02 '15

Then you should just use the === operator.

== is nice when you want to compare data from $_GET etc.

→ More replies (0)