PHP is rife with oddities that can trip you up. I’m going to start keeping track of them here.
‘false’ is true
PHP casts ‘false’ to true.
echo (bool)‘false’ → 1
Other lists
There are many sites on the web that collect them. Here are a couple:
PHP is rife with oddities that can trip you up. I’m going to start keeping track of them here.
PHP casts ‘false’ to true.
echo (bool)‘false’ → 1
There are many sites on the web that collect them. Here are a couple:
Last modified: 19/02/2013 Tags: php
This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan