3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vars = [ 'TRUE' => TRUE, 'FALSE' => FALSE, '1' => 1, '0' => 0, '-1' => -1, '"1"' => "1", '"0"' => "0", '"-1"' => "-1", 'NULL' => NULL, 'array()' => array(), '"php"' => "php", '""' => "", ]; foreach ($vars as $label => $var) { $result = (!$var === empty($var)) ? 'TRUE' : 'FALSE'; echo sprintf("%s: %s\n", $label, $result); }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
TRUE: TRUE FALSE: TRUE 1: TRUE 0: TRUE -1: TRUE "1": TRUE "0": TRUE "-1": TRUE NULL: TRUE array(): TRUE "php": TRUE "": TRUE

preferences:
94.42 ms | 408 KiB | 5 Q