3v4l.org

run code in 300+ PHP versions simultaneously
<?php $version="1.2.124.0bcd4d"; $fullVersion = null; $version = trim($version); if (null === $fullVersion) { $fullVersion = $version; } // ignore aliases and just assume the alias is required instead of the source if (preg_match('{^([^,\s]+) +as +([^,\s]+)$}', $version, $match)) { $version = $match[1]; } // ignore build metadata if (preg_match('{^([^,\s+]+)\+[^\s]+$}', $version, $match)) { $version = $match[1]; } // match master-like branches if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) { return '9999999-dev'; } if ('dev-' === strtolower(substr($version, 0, 4))) { return 'dev-'.substr($version, 4); } print_r($version); /* // match classical versioning if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) { $version = $matches[1] .(!empty($matches[2]) ? $matches[2] : '.0') .(!empty($matches[3]) ? $matches[3] : '.0') .(!empty($matches[4]) ? $matches[4] : '.0'); $index = 5; } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)'.self::$modifierRegex.'$}i', $version, $matches)) { // match date-based versioning $version = preg_replace('{\D}', '-', $matches[1]); $index = 2; } elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) { $version = $matches[1] .(!empty($matches[2]) ? $matches[2] : '.0') .(!empty($matches[3]) ? $matches[3] : '.0') .(!empty($matches[4]) ? $matches[4] : '.0'); $index = 5; } // add version modifiers if a version was matched if (isset($index)) { if (!empty($matches[$index])) { if ('stable' === $matches[$index]) { return $version; } $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index+1]) ? $matches[$index+1] : ''); } if (!empty($matches[$index+2])) { $version .= '-dev'; } return $version; } // match dev branches if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) { try { return $this->normalizeBranch($match[1]); } catch (\Exception $e) { } } $extraMessage = ''; if (preg_match('{ +as +'.preg_quote($version).'$}', $fullVersion)) { $extraMessage = ' in "'.$fullVersion.'", the alias must be an exact version'; } elseif (preg_match('{^'.preg_quote($version).' +as +}', $fullVersion)) { $extraMessage = ' in "'.$fullVersion.'", the alias source must be an exact version, if it is a branch name you should prefix it with dev-'; } throw new \UnexpectedValueException('Invalid version string "'.$version.'"'.$extraMessage); */

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0120.00316.88
8.3.50.0130.00721.24
8.3.40.0160.00018.82
8.3.30.0110.00619.10
8.3.20.0040.00420.52
8.3.10.0080.00023.70
8.3.00.0040.00419.66
8.2.180.0110.00716.63
8.2.170.0120.00319.09
8.2.160.0060.00922.96
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00022.39
8.2.110.0030.00622.39
8.2.100.0120.00017.84
8.2.90.0080.00019.22
8.2.80.0050.00317.97
8.2.70.0070.00317.63
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0040.00419.89
8.2.30.0050.00218.20
8.2.20.0030.00517.77
8.2.10.0000.00817.96
8.2.00.0040.00418.02
8.1.280.0070.00725.92
8.1.270.0040.00420.38
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0040.00422.05
8.1.230.0070.00319.09
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0000.00819.01
8.1.170.0000.00918.63
8.1.160.0040.00421.96
8.1.150.0040.00418.73
8.1.140.0060.00317.45
8.1.130.0040.00417.86
8.1.120.0100.00017.62
8.1.110.0000.00717.59
8.1.100.0050.00217.42
8.1.90.0070.00017.56
8.1.80.0000.00817.56
8.1.70.0000.00717.48
8.1.60.0030.00617.67
8.1.50.0040.00417.49
8.1.40.0040.00417.59
8.1.30.0060.00317.68
8.1.20.0040.00417.79
8.1.10.0000.00817.54
8.1.00.0080.00317.49
8.0.300.0040.00418.77
8.0.290.0000.00717.05
8.0.280.0040.00418.33
8.0.270.0070.00017.12
8.0.260.0050.00217.21
8.0.250.0040.00416.98
8.0.240.0000.00816.95
8.0.230.0000.00717.03
8.0.220.0030.00317.02
8.0.210.0000.00716.94
8.0.200.0000.00817.02
8.0.190.0050.00316.93
8.0.180.0060.00317.07
8.0.170.0040.00416.98
8.0.160.0030.00616.99
8.0.150.0030.00516.77
8.0.140.0050.00217.00
8.0.130.0030.00313.39
8.0.120.0050.00316.87
8.0.110.0030.00617.01
8.0.100.0050.00316.91
8.0.90.0080.00016.91
8.0.80.0070.00816.89
8.0.70.0000.00716.96
8.0.60.0050.00316.85
8.0.50.0030.00516.98
8.0.30.0140.00517.17
8.0.20.0100.00917.40
8.0.10.0030.00417.06
8.0.00.0070.01117.03
7.4.330.0000.00515.03
7.4.320.0000.00616.85
7.4.300.0000.00616.74
7.4.290.0070.00016.79
7.4.280.0000.00716.76
7.4.270.0000.00916.71
7.4.260.0000.00716.80
7.4.250.0040.00416.66
7.4.240.0030.00516.76
7.4.230.0030.00316.46
7.4.220.0060.01216.88
7.4.210.0000.01416.66
7.4.200.0050.00316.91
7.4.160.0130.00416.83
7.4.150.0100.01417.40
7.4.140.0120.00917.86
7.4.130.0070.01216.67
7.4.120.0090.00916.66
7.4.110.0140.01016.74
7.4.100.0070.01116.68
7.4.90.0130.00516.84
7.4.80.0070.01019.39
7.4.70.0100.01016.49
7.4.60.0030.01716.64
7.4.50.0030.00316.59
7.4.40.0090.01116.57
7.4.30.0060.01016.73
7.4.00.0000.00914.96
7.3.330.0050.00013.30
7.3.320.0000.00513.16
7.3.310.0070.00016.40
7.3.300.0080.00016.22
7.3.290.0080.00816.40
7.3.280.0110.00816.43
7.3.270.0090.00917.40
7.3.260.0100.01016.36
7.3.250.0120.00716.53
7.3.240.0130.00516.45
7.3.230.0140.00316.79
7.3.210.0090.00816.68
7.3.200.0080.01216.51
7.3.190.0110.01116.58
7.3.180.0090.00916.61
7.3.170.0030.01316.78
7.3.160.0090.01316.48
7.2.330.0040.01416.61
7.2.320.0070.01116.81
7.2.310.0060.01216.77
7.2.300.0070.01016.63
7.2.290.0130.01016.78
7.2.60.0030.01316.99
7.2.00.0060.00619.79
7.1.200.0000.00715.69
7.1.100.0030.00918.41
7.1.70.0040.00417.23
7.1.60.0170.00719.86
7.1.50.0120.00917.25
7.1.00.0070.07022.33
7.0.200.0240.00015.06
7.0.60.0130.07719.98
7.0.50.0070.08017.91
7.0.40.0100.06320.29
7.0.30.0430.07720.23
7.0.20.0270.06720.20
7.0.10.0030.04320.03
7.0.00.0030.04720.05
5.6.280.0000.07720.89
5.6.210.0070.08320.60
5.6.200.0100.04018.16
5.6.190.0000.04720.32
5.6.180.0230.08020.49
5.6.170.0400.07320.54
5.6.160.0030.07020.49
5.6.150.0130.07318.19
5.6.140.0100.07318.11
5.6.130.0130.08018.17
5.6.120.0200.07021.12
5.6.110.0130.06320.97
5.6.100.0130.08021.12
5.6.90.0000.06021.01
5.6.80.0100.07320.42
5.5.350.0000.03720.35
5.5.340.0130.05017.92
5.5.330.0000.04720.17
5.5.320.3670.04020.18
5.5.310.0330.07320.28
5.5.300.0100.07718.02
5.5.290.0100.07717.90
5.5.280.0100.08020.84
5.5.270.0070.04320.78
5.5.260.0100.07320.86
5.5.250.0170.07320.69
5.5.240.0100.06020.06
5.4.450.0930.03719.42
5.4.440.0400.04719.41
5.4.430.0470.04319.45
5.4.420.0200.08319.31
5.4.410.0070.06719.25
5.4.400.0100.05319.17
5.4.390.0170.04719.00
5.4.380.0200.05719.02
5.4.370.0100.06019.16
5.4.360.0030.06019.16
5.4.350.0100.06019.00
5.4.340.0100.06018.98
5.4.320.0070.05719.16
5.4.310.0130.05018.92
5.4.300.0100.05319.16
5.4.290.0200.06319.05
5.4.280.0100.05318.91
5.4.270.0100.06018.91
5.4.260.0070.06318.99
5.4.250.0170.05319.16
5.4.240.0130.05019.16
5.4.230.0130.05018.98
5.4.220.0070.06019.05
5.4.210.0070.06318.98
5.4.200.0030.05716.51
5.4.190.0170.05019.25
5.4.180.0030.05719.09
5.4.170.0070.07018.90
5.4.160.0030.06018.97
5.4.150.0100.05718.89
5.4.140.0130.05716.20
5.4.130.0170.05316.46
5.4.120.0130.05316.57
5.4.110.0070.05316.25
5.4.100.0130.05016.41
5.4.90.0030.06016.28
5.4.80.0070.05716.54
5.4.70.0200.05316.54
5.4.60.0200.04316.09
5.4.50.0070.05016.48
5.4.40.0070.05316.48
5.4.30.0200.04016.38
5.4.20.0200.04716.09
5.4.10.0130.04316.38
5.4.00.0230.03715.64
5.3.290.0130.05314.73
5.3.280.0030.06014.57
5.3.270.0130.05714.57
5.3.260.0200.05014.61
5.3.250.0070.05714.56
5.3.240.0100.05314.61
5.3.230.0070.05314.56
5.3.220.0270.06714.66
5.3.210.0130.05714.42
5.3.200.0170.05014.51
5.3.190.0130.06314.54
5.3.180.0170.04714.54
5.3.170.0100.05714.49
5.3.160.0170.05714.46
5.3.150.0200.05714.59
5.3.140.0230.03714.63
5.3.130.0200.04314.40
5.3.120.0100.05314.55
5.3.110.0070.06714.52
5.3.100.0130.04714.05
5.3.90.0070.05314.09
5.3.80.0030.07013.96
5.3.70.0030.07314.11
5.3.60.0200.05713.91
5.3.50.0100.06313.84
5.3.40.0100.06713.87
5.3.30.0200.05713.82
5.3.20.0000.05713.54
5.3.10.0070.06013.73
5.3.00.0070.05713.68
5.2.170.0070.04311.13
5.2.160.0030.04711.13
5.2.150.0030.04311.30
5.2.140.0030.04311.09
5.2.130.0030.04311.21
5.2.120.0030.04311.18
5.2.110.0100.03711.02
5.2.100.0070.04311.11
5.2.90.0100.05310.96
5.2.80.0030.04710.95
5.2.70.0030.05011.00
5.2.60.0030.04711.21
5.2.50.0070.05310.98
5.2.40.0070.04010.91
5.2.30.0100.04011.09
5.2.20.0100.04010.96
5.2.10.0030.04310.90
5.2.00.0200.04010.87
5.1.60.0070.04310.16
5.1.50.0100.03710.05
5.1.40.0030.0439.93
5.1.30.0130.03710.30
5.1.20.0030.05310.46
5.1.10.0030.05010.17
5.1.00.0000.04010.13
5.0.50.0070.0338.71
5.0.40.0070.0338.41
5.0.30.0070.0438.22
5.0.20.0170.0178.42
5.0.10.0070.0378.35
5.0.00.0030.0438.16
4.4.90.0000.0235.96
4.4.80.0000.0335.82
4.4.70.0070.0205.97
4.4.60.0070.0275.89
4.4.50.0030.0305.85
4.4.40.0000.0435.97
4.4.30.0030.0305.89
4.4.20.0100.0235.93
4.4.10.0000.0236.04
4.4.00.0000.0375.83
4.3.110.0000.0235.77
4.3.100.0030.0305.79
4.3.90.0070.0275.88
4.3.80.0070.0405.91
4.3.70.0070.0235.82
4.3.60.0100.0135.91
4.3.50.0030.0205.70
4.3.40.0070.0305.80
4.3.30.0000.0274.64
4.3.20.0030.0274.58
4.3.10.0030.0204.45
4.3.00.0030.02315.37

preferences:
58.22 ms | 401 KiB | 5 Q