Strange behavior of PHP Comparing operator
Recently, I've started working on some OpenStack API. I'm sharing this coding experience with you.
Take you time and think following PHP code is wrong or right ?
<?php var_dump(md5('240610708') == md5('QNKCDZO')); ?>
You can run this code here
I was expecting the answer false, however the PHP says the above mentioned value is equal.
The correct way to write the PHP comparing -
<?php var_dump(md5('240610708') === md5('QNKCDZO')); ?>
So, today I found for comparing always === in PHP code.
- Do you really know that PHP is strange programming language34 votes
Waxspace.in Pune Location VPS - 28 USD/Mo 2GB RAM, 45 GB Storage - Plan will be Launched Soon at Waxspace