Skip to content

Instantly share code, notes, and snippets.

@kitek
Last active January 3, 2016 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitek/5709350 to your computer and use it in GitHub Desktop.
Save kitek/5709350 to your computer and use it in GitHub Desktop.
Porównanie string vs bool
Porównanie string vs bool:
"00" == "0" → bool(true)
"0" == false → bool(true)
ale już:
"00" == false → bool(false)
Porównanie null vs bool vs string:
null == false → bool(true)
false == "0" → bool(true)
ale już:
null == "0" → bool(false)
Porównanie array vs int:
array() == 0 → bool(false)
array(1,2,3) == 0 → bool(false)
ale już:
(int)array() == 0 → bool(true)
(int)array(1,2,3) == 1 → bool(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment