3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php my_version_compare("2.5.1", "2.5.2"); # => -1 (smaller) my_version_compare("2.5.2", "2.5.2"); # => 0 (equal) my_version_compare("2.5.5", "2.5.2"); # => 1 (bigger) my_version_compare("2.5", "2.5.2"); # => 1 (bigger, eleven is bigger than two) function my_version_compare($version1, $version2) { echo 'strnatcmp: ', var_dump(strnatcmp($version1, $version2)); echo 'version_compare: ', var_dump(version_compare($version1, $version2)), "\n"; }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
strnatcmp: int(-1) version_compare: int(-1) strnatcmp: int(0) version_compare: int(0) strnatcmp: int(1) version_compare: int(1) strnatcmp: int(-1) version_compare: int(-1)