3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(version_compare('3.7.5', '3.7.0', 'ge')); // true, OK var_dump(version_compare('3.7.5', '3.7.0', ' ')); // null, should throw invalid argument exception at best var_dump(version_compare('3.7.5', '3.7.0', ' ge')); // null, should throw invalid argument exception at best var_dump(version_compare('3.7.5', '3.7.0', 'ge ')); // null, should throw invalid argument exception at best var_dump(version_compare('3.7.5', '3.7.0', 'invalid')); // null, should throw invalid argument exception at best
based on R0lf8
Output for 8.0.0
bool(true) Fatal error: Uncaught ValueError: version_compare(): Argument #3 ($operator) must be a valid comparison operator in /in/CrO0J:4 Stack trace: #0 /in/CrO0J(4): version_compare('3.7.5', '3.7.0', ' ') #1 {main} thrown in /in/CrO0J on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.27, 7.2.0 - 7.2.33, 7.3.0 - 7.3.26, 7.4.0 - 7.4.14
bool(true) NULL NULL NULL NULL
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/CrO0J on line 7
Process exited with code 255.