3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $primary = 0; echo ($primary || $primary === "0" || $primary === 0) ? 1 : 0; echo "\n\r"; echo ("- " . (!empty($primary) ? 1 : 0)); echo "\n\r"; $primary = "0"; echo ($primary || $primary === "0" || $primary === 0) ? 1 : 0; echo "\n\r"; echo ("- " . (!empty($primary) ? 1 : 0)); echo "\n\r"; $primary = NULL; echo ($primary || $primary === "0" || $primary === 0) ? 1 : 0; echo "\n\r"; echo ("- " . (!empty($primary) ? 1 : 0)); echo "\n\r"; $primary = ''; echo ($primary || $primary === "0" || $primary === 0) ? 1 : 0; echo "\n\r"; echo ("- " . (!empty($primary) ? 1 : 0)); echo "\n\r";
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1 - 0 1 - 0 0 - 0 0 - 0