3v4l.org

run code in 300+ PHP versions simultaneously
<?php $functionDef = <<<'EOF' <?php function notThisOne( $baz = 'boz') {} function foo ( Bar $bar, Baz $baz = 'string with, comma', $boz = ['something'] ) { } EOF; $function = 'foo'; $argument = 'baz'; if (!preg_match('/function\s+' . preg_quote($function) . '\s*\(\s*(?P<args>.*?)\)/is', $functionDef, $matches)) { throw new RuntimeException('Cound not find parameters for function ' . $function); } $tokens = token_get_all('<?php ' . $matches['args']); // small state machine, better in a class $foundArg = false; $default = ''; while ($token = next($tokens)) { // find the argument first of all if (!$foundArg) { if (is_array($token) && $token[1] == '$'.$argument) { $foundArg = true; } continue; } // detect when we have got to the end of the definitoin if ($token === ',') { break; } // compile everything else into the string if (is_string($token)) { $default .= $token; } else { $default .= $token[1]; } } var_dump($default);

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.70.0120.00316.86
8.3.60.0070.01118.42
8.3.50.0180.00221.24
8.3.40.0110.00419.04
8.3.30.0120.00319.17
8.3.20.0080.00020.14
8.3.10.0090.00023.47
8.3.00.0080.00019.80
8.2.190.0110.00418.79
8.2.180.0060.00918.79
8.2.170.0120.00318.91
8.2.160.0100.00322.96
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00020.99
8.2.110.0030.00622.22
8.2.100.0000.01118.16
8.2.90.0000.00819.30
8.2.80.0080.00017.97
8.2.70.0030.00617.75
8.2.60.0040.00417.92
8.2.50.0040.00418.10
8.2.40.0000.00720.50
8.2.30.0030.00618.14
8.2.20.0040.00417.77
8.2.10.0080.00018.20
8.2.00.0040.00418.02
8.1.280.0080.00825.92
8.1.270.0080.00020.43
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00922.19
8.1.230.0050.00517.70
8.1.220.0030.00517.78
8.1.210.0030.00518.77
8.1.200.0030.00717.48
8.1.190.0090.00017.35
8.1.180.0030.00518.10
8.1.170.0000.00818.59
8.1.160.0040.00422.03
8.1.150.0000.00718.75
8.1.140.0040.00417.56
8.1.130.0050.00217.85
8.1.120.0040.00417.45
8.1.110.0000.00817.57
8.1.100.0000.00817.60
8.1.90.0040.00417.58
8.1.80.0020.00517.55
8.1.70.0040.00417.41
8.1.60.0030.00517.64
8.1.50.0040.00417.66
8.1.40.0040.00417.69
8.1.30.0000.00817.80
8.1.20.0000.00817.86
8.1.10.0000.00817.77
8.1.00.0000.01117.35
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0070.00018.40
8.0.270.0040.00417.18
8.0.260.0000.00617.27
8.0.250.0030.00317.18
8.0.240.0000.00917.02
8.0.230.0000.00717.05
8.0.220.0070.00017.13
8.0.210.0000.00717.05
8.0.200.0030.00317.13
8.0.190.0030.00517.18
8.0.180.0030.00517.08
8.0.170.0000.00817.04
8.0.160.0000.00817.19
8.0.150.0070.00017.01
8.0.140.0030.00516.94
8.0.130.0070.00013.48
8.0.120.0050.00317.01
8.0.110.0040.00417.10
8.0.100.0040.00417.04
8.0.90.0080.00017.14
8.0.80.0090.01416.98
8.0.70.0040.00417.07
8.0.60.0050.00316.98
8.0.50.0050.00317.07
8.0.30.0120.00817.34
8.0.20.0120.00717.46
8.0.10.0000.00717.09
8.0.00.0110.00716.96
7.4.330.0030.00315.04
7.4.320.0060.00016.81
7.4.300.0000.00716.82
7.4.290.0000.00716.57
7.4.280.0080.00316.71
7.4.270.0030.00316.80
7.4.260.0000.00816.74
7.4.250.0040.00416.80
7.4.240.0050.00216.76
7.4.230.0000.00716.81
7.4.220.0180.00016.83
7.4.210.0090.00616.77
7.4.200.0070.00016.69
7.4.160.0150.00616.64
7.4.150.0070.01117.40
7.4.140.0080.01317.86
7.4.130.0130.00716.74
7.4.120.0100.00916.86
7.4.110.0100.01316.63
7.4.100.0130.00916.50
7.4.90.0120.00416.67
7.4.80.0130.00319.39
7.4.70.0080.00816.93
7.4.60.0060.00916.77
7.4.50.0000.00716.67
7.4.40.0040.01216.48
7.4.30.0100.00716.79
7.4.00.0120.00315.05
7.3.330.0030.00313.28
7.3.320.0020.00313.44
7.3.310.0030.00316.39
7.3.300.0070.00016.42
7.3.290.0070.00816.52
7.3.280.0100.00816.56
7.3.270.0140.01017.40
7.3.260.0030.01416.57
7.3.250.0120.00816.76
7.3.240.0080.00816.81
7.3.230.0130.00716.54
7.3.210.0110.00616.51
7.3.200.0060.01016.64
7.3.190.0170.00316.60
7.3.180.0140.00316.66
7.3.170.0060.01016.65
7.3.160.0130.00316.57
7.2.330.0090.00916.77
7.2.320.0140.00316.74
7.2.310.0150.00416.97
7.2.300.0070.01017.01
7.2.290.0130.00616.95
7.2.00.0030.01319.61
7.1.70.0000.00717.39
7.1.60.0060.01219.86
7.1.50.0040.02116.86
7.1.00.0070.06722.47
7.0.200.0030.01016.93
7.0.100.0130.07020.12
7.0.90.0170.08019.89
7.0.80.0000.09020.08
7.0.70.0070.07319.80
7.0.60.0030.07719.86
7.0.50.0130.07720.39
7.0.40.0070.08319.92
7.0.30.0170.08020.10
7.0.20.0030.08720.13
7.0.10.0070.08320.10
7.0.00.0070.08720.04
5.6.280.0000.07721.07
5.6.250.0070.07720.61
5.6.240.0230.06320.54
5.6.230.0030.09720.56
5.6.220.0100.08320.43
5.6.210.0070.07020.40
5.6.200.0170.07721.08
5.6.190.0130.08020.95
5.6.180.0200.06020.93
5.6.170.0070.08721.02
5.6.160.0030.08321.02
5.6.150.0030.08721.02
5.6.140.0100.08020.95
5.6.130.0100.08720.93
5.6.120.0070.09020.93
5.6.110.0070.07721.09
5.6.100.0070.06020.98
5.6.90.0130.07321.07
5.6.80.0070.07720.55
5.6.70.0030.05020.31
5.6.60.0070.07720.50
5.6.50.0030.07320.42
5.6.40.0100.06320.43
5.6.30.0130.07020.44
5.6.20.0070.05020.30
5.6.10.0030.08020.38
5.6.00.0170.04720.38
5.5.380.0100.07020.29
5.5.370.0070.07320.50
5.5.360.0100.08320.26
5.5.350.0100.08020.27
5.5.340.0130.07020.90
5.5.330.0100.06320.90
5.5.320.0130.07720.76
5.5.310.0170.07720.73
5.5.300.0070.08720.83
5.5.290.0170.07720.87
5.5.280.0000.09020.83
5.5.270.0070.07720.77
5.5.260.0070.07720.85
5.5.250.0100.08020.54
5.5.240.0130.07720.27
5.5.230.0170.07320.17
5.5.220.0070.08020.20
5.5.210.0100.07720.27
5.5.200.0070.08320.27
5.5.190.0070.08020.14
5.5.180.0170.07020.08
5.5.160.0100.07320.23
5.5.150.0100.07320.28
5.5.140.0100.07720.18
5.5.130.0100.04020.16
5.5.120.0070.08020.26
5.5.110.0100.07720.27
5.5.100.0030.06320.05
5.5.90.0030.04720.07
5.5.80.0030.08320.04
5.5.70.0030.04720.09
5.5.60.0130.06320.03
5.5.50.0070.07719.93
5.5.40.0000.05320.05
5.5.30.0170.05320.07
5.5.20.0030.08020.13
5.5.10.0030.08320.04
5.5.00.0030.05319.96
5.4.450.0070.07719.39
5.4.440.0170.06719.11
5.4.430.0030.05719.39
5.4.420.0230.06719.46
5.4.410.0030.06319.27
5.4.400.0070.08018.82
5.4.390.0330.05319.07
5.4.380.0100.03719.06
5.4.370.0130.07018.96
5.4.360.0070.05019.14
5.4.350.0070.03718.97
5.4.340.0030.07318.96
5.4.320.0100.04319.23
5.4.310.0170.05718.90
5.4.300.0070.07718.98
5.4.290.0200.06719.05
5.4.280.0130.07019.24
5.4.270.0170.06318.81
5.4.260.0070.07318.98
5.4.250.0070.04319.14
5.4.240.0070.07719.23
5.4.230.0030.05019.15
5.4.220.0170.06719.08
5.4.210.0070.06018.94
5.4.200.0100.07318.78
5.4.190.0070.08019.22
5.4.180.0100.06319.11
5.4.170.0070.05719.11
5.4.160.0130.07018.92
5.4.150.0070.08018.94
5.4.140.0100.07016.08
5.4.130.0070.06716.46
5.4.120.0130.07316.07
5.4.110.0070.05316.23
5.4.100.0070.08016.35
5.4.90.0070.08016.48
5.4.80.0100.07016.43
5.4.70.0100.07016.31
5.4.60.0130.06016.45
5.4.50.0030.07316.28
5.4.40.0030.07316.43
5.4.30.0100.07316.27
5.4.20.0070.07316.29
5.4.10.0000.08016.41
5.4.00.0070.07015.83
5.3.290.0000.08014.50
5.3.280.0030.08314.47
5.3.270.0070.08014.50
5.3.260.0100.07714.48
5.3.250.0130.07314.61
5.3.240.0070.08014.53
5.3.230.0030.04014.45
5.3.220.0070.06014.40
5.3.210.0100.07014.52
5.3.200.0070.06314.52
5.3.190.0070.08014.43
5.3.180.0100.06714.52
5.3.170.0070.06314.44
5.3.160.0070.07714.56
5.3.150.0070.07714.43
5.3.140.0100.03314.48
5.3.130.0100.08014.51
5.3.120.0030.06014.42
5.3.110.0130.06714.47
5.3.100.0000.09014.00
5.3.90.0070.07714.02
5.3.80.0030.06314.02
5.3.70.0030.07714.02
5.3.60.0230.04714.00
5.3.50.0100.07313.92
5.3.40.0000.07013.91
5.3.30.0100.05713.91
5.3.20.0130.06313.62
5.3.10.0030.06713.64
5.3.00.0200.06013.60
5.2.170.0130.05011.00
5.2.160.0100.06010.97
5.2.150.0070.05010.96
5.2.140.0000.06711.20
5.2.130.0070.05310.95
5.2.120.0100.05011.17
5.2.110.0100.05711.12
5.2.100.0030.06710.93
5.2.90.0100.05711.05
5.2.80.0070.05711.09
5.2.70.0100.05711.14
5.2.60.0130.02711.04
5.2.50.0000.03311.02
5.2.40.0100.05710.93
5.2.30.0070.05310.79
5.2.20.0000.04710.84
5.2.10.0070.05710.75
5.2.00.0070.06010.63
5.1.60.0070.0509.87
5.1.50.0070.0509.95
5.1.40.0070.0509.97
5.1.30.0100.05010.38
5.1.20.0030.05710.27
5.1.10.0100.04310.06
5.1.00.0030.05710.05
5.0.50.0000.0478.54
5.0.40.0030.0438.50
5.0.30.0030.0638.50
5.0.20.0070.0438.50
5.0.10.0070.0338.50
5.0.00.0070.0578.50
4.4.90.0070.0308.50
4.4.80.0070.0138.50
4.4.70.0000.0378.50
4.4.60.0000.0278.50
4.4.50.0030.0138.50
4.4.40.0000.0578.50
4.4.30.0030.0338.50
4.4.20.0030.0378.50
4.4.10.0000.0378.50
4.4.00.0000.0578.50
4.3.110.0000.0378.50
4.3.100.0030.0338.50
4.3.90.0000.0378.50
4.3.80.0000.0478.50
4.3.70.0000.0308.50
4.3.60.0000.0208.50
4.3.50.0100.0278.50
4.3.40.0100.0438.50
4.3.30.0000.0378.50
4.3.20.0000.0308.50
4.3.10.0030.0338.50
4.3.00.0000.0408.50

preferences:
47.57 ms | 401 KiB | 5 Q