3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = trim('-1'); echo $str . "\n"; if ($str) { echo "option 1: not empty\n"; } if (strlen($str)) { echo "option 2: not empty\n"; } if (!empty($str)) { echo "option 3: not empty\n"; } if ($str !== '') { echo "option 4: not empty\n"; }

preferences:
36.26 ms | 402 KiB | 5 Q