3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compareVersion($version1, $version2) { $partsV1 = explode('.', $version1); $partsV2 = explode('.', $version2); $partsV1Size = count($partsV1); $partsV2Size = count($partsV2); $longest = max($partsV1Size, $partsV2Size); for ($i = 0; $i < $longest; ++$i) { $v1 = $partsV1Size > $i ? intval($partsV1[$i]) : 0; $v2 = $partsV2Size > $i ? intval($partsV2[$i]) : 0; if ($v1 < $v2) { return -1; } else if ($v1 > $v2) { return 1; } } return 0; } var_dump(compareVersion("01.0", "1"));
Output for git.master, git.master_jit, rfc.property-hooks
int(0)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.46 ms | 401 KiB | 8 Q