@MightyPork/php-bool-casts

PHP bool casts

Description

Casting various values to bool in PHP, the results are sometimes surprising.

(I know the exports are wrong here, that's part of why I submitted this. testing the boolean column type)

License CC0
Created 3 months ago
Updated 3 months ago
Revisions 4 (see changes)
Visits 87  
Column toggles, sort, filtering … coming soon
Export presets:

Note: In the X Macro option, add &noq=foo,bar to the URL to strip quotes from specified columns

Input Boolean value Note
'' false
'[]' true !
[] false
0 false
'0' false
'0.0' true WRONG
0.0 false
1 true
-1 true
'1' true
'1.0' true
1.0 true
false false
'false' true !
NULL false
(object)[] true WRONG
true true
'true' true