3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = new ReflectionClass(A::class); extractMethodBody($re->getMethod('test')); /** * @param \ReflectionMethod $method * @return string */ function extractMethodBody(\ReflectionMethod $method) { $startLine = $method->getStartLine(); $endLine = $method->getEndLine() + 1; $resource = fopen($method->getFileName(), 'r'); $currentLine = 0; while (!feof($resource) && ++$currentLine < $startLine) { fgets($resource, 1024); } $buffer = ''; while (!feof($resource) && ++$currentLine <= $endLine) { $buffer .= fgets($resource, 1024); } preg_match(sprintf('/(?:public|protected|private|final|abstract|static)*?' . '\s+function\s+%s\([^\)]*\)\s*(?:\{(?:[^{}]*|(?R))*\})/sm', preg_quote($method->getName())), $buffer, $matches ); return $matches[0]; } class A { public function test(stdClass $b) { return $b; } }

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.0110.00718.65
8.3.50.0110.00418.54
8.3.40.0070.00718.97
8.3.30.0090.00619.08
8.3.20.0050.00320.34
8.3.10.0040.00421.86
8.3.00.0080.00019.00
8.2.180.0160.00318.66
8.2.170.0050.01022.96
8.2.160.0140.00720.44
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0100.00022.43
8.2.110.0030.00719.39
8.2.100.0000.01218.01
8.2.90.0050.00317.97
8.2.80.0040.00417.97
8.2.70.0000.00818.03
8.2.60.0030.00618.16
8.2.50.0060.00318.10
8.2.40.0080.00021.11
8.2.30.0000.00820.69
8.2.20.0040.00417.91
8.2.10.0080.00018.25
8.2.00.0050.00317.86
8.1.280.0070.01125.92
8.1.270.0040.00418.93
8.1.260.0070.00026.35
8.1.250.0000.00928.09
8.1.240.0030.01017.83
8.1.230.0090.00322.55
8.1.220.0080.00017.77
8.1.210.0030.00519.10
8.1.200.0090.00017.60
8.1.190.0000.00817.60
8.1.180.0080.00018.10
8.1.170.0060.00318.93
8.1.160.0030.00618.82
8.1.150.0020.00518.87
8.1.140.0000.00917.60
8.1.130.0030.00317.88
8.1.120.0040.00417.62
8.1.110.0070.00017.64
8.1.100.0040.00417.61
8.1.90.0050.00217.66
8.1.80.0080.00017.54
8.1.70.0030.00517.66
8.1.60.0060.00317.79
8.1.50.0040.00417.70
8.1.40.0030.00517.59
8.1.30.0000.00917.75
8.1.20.0060.00317.73
8.1.10.0030.00517.81
8.1.00.0060.00317.70
8.0.300.0070.00019.89
8.0.290.0040.00417.00
8.0.280.0000.00818.44
8.0.270.0030.00517.42
8.0.260.0030.00317.43
8.0.250.0030.00317.17
8.0.240.0030.00317.26
8.0.230.0070.00017.22
8.0.220.0000.00717.23
8.0.210.0000.00717.09
8.0.200.0030.00317.25
8.0.190.0000.00817.26
8.0.180.0080.00017.13
8.0.170.0030.00617.19
8.0.160.0050.00317.28
8.0.150.0060.00317.21
8.0.140.0050.00217.16
8.0.130.0030.00313.59
8.0.120.0050.00317.07
8.0.110.0000.00717.18
8.0.100.0000.00817.25
8.0.90.0080.00317.20
8.0.80.0100.00617.20
8.0.70.0090.00017.01
8.0.60.0040.00417.19
8.0.50.0080.00017.23
8.0.30.0120.00917.37
8.0.20.0080.01017.45
8.0.10.0050.00317.31
8.0.00.0080.01017.04
7.4.330.0000.00515.20
7.4.320.0060.00016.86
7.4.300.0000.00716.90
7.4.290.0000.00716.77
7.4.280.0060.00316.73
7.4.270.0000.00716.85
7.4.260.0040.00416.75
7.4.250.0030.00516.70
7.4.240.0040.00416.84
7.4.230.0030.00316.88
7.4.220.0080.01216.91
7.4.210.0090.01216.83
7.4.200.0040.00416.75
7.4.160.0130.00316.90
7.4.150.0090.00917.40
7.4.140.0130.00817.86
7.4.130.0060.01116.86
7.4.120.0080.00916.86
7.4.110.0100.00716.73
7.4.100.0030.01316.65
7.4.90.0040.01417.08
7.4.80.0120.00619.39
7.4.70.0130.00316.87
7.4.60.0090.00816.62
7.4.50.0030.00616.51
7.4.40.0110.00716.76
7.4.30.0090.00916.77
7.4.00.0090.00615.21
7.3.330.0000.00513.55
7.3.320.0030.00313.39
7.3.310.0060.00016.43
7.3.300.0000.00816.48
7.3.290.0090.00716.50
7.3.280.0090.01216.54
7.3.270.0150.00917.40
7.3.260.0110.00716.86
7.3.250.0100.01016.62
7.3.240.0000.01716.60
7.3.230.0030.01416.48
7.3.210.0040.01916.74
7.3.200.0110.00619.39
7.3.190.0040.01216.49
7.3.180.0140.00316.64
7.3.170.0100.00716.59
7.3.160.0110.00616.92
7.2.330.0110.00616.88
7.2.320.0090.00916.98
7.2.310.0100.00716.79
7.2.300.0070.01017.04
7.2.290.0140.00316.84
7.2.00.0090.00019.71
7.1.100.0030.01018.48
7.1.70.0000.00817.24
7.1.60.0160.00619.57
7.1.50.0250.00635.08
7.1.00.0030.07722.55
7.0.200.0070.00416.91
7.0.140.0000.06722.18
7.0.60.0130.07021.87
7.0.50.0030.08317.91
7.0.40.0100.08020.22
7.0.30.0300.08720.27
7.0.20.0370.07020.24
7.0.10.0100.08020.24
7.0.00.0030.05320.18
5.6.280.0000.07721.07
5.6.210.0100.05720.48
5.6.200.0030.05018.19
5.6.190.0100.04020.42
5.6.180.0300.05720.64
5.6.170.0070.05020.51
5.6.160.0070.07020.52
5.6.150.0070.08018.20
5.6.140.0100.06018.18
5.6.130.0070.06018.28
5.6.120.0100.08021.04
5.6.110.0030.09321.10
5.6.100.0130.06021.14
5.6.90.0000.04321.04
5.6.80.0070.04720.54
5.5.350.4270.04020.46
5.5.340.0100.06017.95
5.5.330.0070.03720.40
5.5.320.0630.06720.25
5.5.310.0230.07020.50
5.5.300.0030.08717.93
5.5.290.0030.04017.95
5.5.280.0200.07020.81
5.5.270.0070.06320.65
5.5.260.0100.08020.88
5.5.250.0130.07720.77
5.5.240.0070.08020.19
5.4.450.3830.04019.48
5.4.440.3000.04319.32
5.4.430.3670.04019.53
5.4.420.4000.03319.59
5.4.410.3700.03319.42
5.4.400.4430.04019.23
5.4.390.3530.03319.11
5.4.380.3500.03719.24
5.4.370.3930.03319.14
5.4.360.3800.04018.97
5.4.350.3830.04019.15
5.4.340.3870.04019.18
5.4.320.3630.03319.11
5.4.310.3870.03319.13
5.4.300.2030.04318.95
5.4.290.0130.06718.96
5.4.280.0030.07719.23
5.4.270.4670.03018.95
5.4.260.4200.04719.06
5.4.250.3630.03718.93
5.4.240.3600.04019.13
5.4.230.3670.03019.21
5.4.220.3530.03318.93
5.4.210.3630.03718.98
5.4.200.3000.03319.19
5.4.190.1970.04018.98
5.4.180.0000.04019.05
5.4.170.3430.04319.12
5.4.160.3900.03718.96
5.4.150.3730.04719.02
5.4.140.4100.04316.46
5.4.130.4100.04016.35
5.4.120.3930.02716.25
5.4.110.3570.04016.35
5.4.100.4000.03016.52
5.4.90.3570.03716.48
5.4.80.3870.03016.46
5.4.70.3370.04016.35
5.4.60.3800.04016.58
5.4.50.3730.03316.47
5.4.40.3730.03716.53
5.4.30.4370.03316.45
5.4.20.4500.03316.61
5.4.10.4000.03716.52
5.4.00.3900.03315.97
5.3.290.3870.03714.62
5.3.280.3630.03714.54
5.3.270.3600.03314.53
5.3.260.3900.03314.54
5.3.250.3800.03714.48
5.3.240.3700.04314.52
5.3.230.3770.03314.53
5.3.220.3770.04014.49
5.3.210.3870.04014.50
5.3.200.3830.04014.50
5.3.190.3930.03014.58
5.3.180.3730.04314.36
5.3.170.3500.04314.38
5.3.160.4030.03314.50
5.3.150.3870.03314.52
5.3.140.3830.03314.57
5.3.130.4770.03014.52
5.3.120.4500.04314.57
5.3.110.4430.04014.50
5.3.100.3830.03314.00
5.3.90.3900.02713.95
5.3.80.3630.04013.85
5.3.70.3800.04013.96
5.3.60.3600.03713.93
5.3.50.3530.03713.88
5.3.40.3970.04013.88
5.3.30.3530.03313.70
5.3.20.4100.04013.48
5.3.10.3570.03713.59
5.3.00.3070.03013.60
5.2.170.4730.03311.02
5.2.160.3400.03711.07
5.2.150.2930.03011.23
5.2.140.3830.02011.13
5.2.130.3470.02711.18
5.2.120.3170.03011.18
5.2.110.3470.02711.03
5.2.100.3630.03311.00
5.2.90.3770.02711.04
5.2.80.3500.03010.98
5.2.70.3900.02011.02
5.2.60.3870.02711.12
5.2.50.3900.03010.87
5.2.40.3100.03010.98
5.2.30.2870.02310.98
5.2.20.2800.03010.78
5.2.10.2130.03010.92
5.2.00.2930.02710.72
5.1.60.2400.0279.83
5.1.50.3000.0309.99
5.1.40.2300.03010.04
5.1.30.2670.02010.34
5.1.20.2630.02310.36
5.1.10.2600.02710.04
5.1.00.2570.03010.11
5.0.50.1200.0178.55
5.0.40.1170.0238.39
5.0.30.1170.0338.21
5.0.20.1830.0138.10
5.0.10.1430.0178.07
5.0.00.1600.0338.16
4.4.90.1730.0206.10
4.4.80.1430.0136.10
4.4.70.1430.0176.10
4.4.60.1500.0136.10
4.4.50.1770.0136.10
4.4.40.1400.0276.10
4.4.30.1600.0176.10
4.4.20.1400.0136.10
4.4.10.1170.0176.10
4.4.00.1400.0306.10
4.3.110.1200.0176.10
4.3.100.1370.0136.10
4.3.90.1870.0206.10
4.3.80.1300.0236.10
4.3.70.1700.0136.10
4.3.60.1700.0176.04
4.3.50.1630.0176.04
4.3.40.1530.0206.04
4.3.30.0900.0236.04
4.3.20.0930.0236.04
4.3.10.0900.0206.04
4.3.00.0930.0206.04

preferences:
79.29 ms | 400 KiB | 5 Q