Skip to content

Instantly share code, notes, and snippets.

@pmgupte
Created December 18, 2013 16:29
Show Gist options
  • Select an option

  • Save pmgupte/8025297 to your computer and use it in GitHub Desktop.

Select an option

Save pmgupte/8025297 to your computer and use it in GitHub Desktop.
PHP comparison is so inconsistent.
<?php
var_dump(null == 0); // evaluates to true
var_dump(null < -1); // this also evaluates to true
// so, how can some predefined value be equal to 0 as well as be less than -1?
?>
@suvera
Copy link

suvera commented May 6, 2015

null evaluates to "0" when you compare to numeric values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment