3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = ['1,23,45,123,145,200', '345,999,0,1', '0', '0,2', '-1,-122', '', '1.5,2.9']; foreach ($tests as $test) { $before_comma = strstr($test, ',', true); var_export($before_comma === false ? $test : $before_comma); echo "\n"; }
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.23, 8.0.0 - 8.0.10, 8.1rc1 - rc2
'1' '345' '0' '0' '-1' '' '1.5'

preferences:
92.46 ms | 533 KiB | 16 Q