3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar { class Baz {} } namespace { function byReflection($obj) { $r = new ReflectionObject($obj); return $r->getShortName(); } function byString($obj) { $class = get_class($obj); return ltrim(strrchr($class, '\\'), '\\') ?: $class; } function benchmark(callable $func, $param, $message) { echo "Benchmarking $message\n"; $s = microtime(true); for ($i = 0; $i < 10000; $i++) { $func($param); } $e = microtime(true); echo " - Completed in " . ($e - $s) . " seconds\n"; } $a = new StdClass; $b = new Foo\Bar\Baz; benchmark("byReflection", $a, "By Reflection, No Namespace"); benchmark("byReflection", $b, "By Reflection, Namespace"); benchmark("byString", $a, "By String, No Namespace"); benchmark("byString", $b, "By String, Namespace"); }

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)
7.4.10.0050.02414.95
7.4.00.0110.01914.82
7.3.130.0070.02414.73
7.3.120.0070.02214.93
7.3.110.0100.02214.92
7.3.100.0040.02614.83
7.3.90.0040.02514.82
7.3.80.0070.01715.00
7.3.70.0060.02114.81
7.3.60.0100.02014.77
7.3.50.0090.02514.73
7.3.40.0100.01614.80
7.3.30.0060.01914.69
7.3.20.0030.02316.08
7.3.10.0080.01816.03
7.3.00.0090.01615.94
7.2.260.0020.03015.06
7.2.250.0080.02914.95
7.2.240.0090.02215.21
7.2.230.0070.01915.33
7.2.220.0070.02714.99
7.2.210.0050.02215.10
7.2.200.0050.02515.00
7.2.190.0040.02514.92
7.2.180.0060.02314.95
7.2.170.0070.02714.95
7.2.160.0050.02414.90
7.2.150.0070.02116.03
7.2.140.0060.02316.03
7.2.130.0050.02216.13
7.2.120.0050.02416.11
7.2.110.0050.02315.97
7.2.100.0060.02215.96
7.2.90.0070.02215.90
7.2.80.0050.02516.02
7.2.70.0120.01916.08
7.2.60.0080.02116.05
7.2.50.0030.02515.95
7.2.40.0050.02115.98
7.2.30.0050.02516.08
7.2.20.0050.02416.02
7.2.10.0030.02315.80
7.2.00.0070.02317.18
7.1.330.0060.03515.05
7.1.320.0100.02815.24
7.1.310.0070.02615.22
7.1.300.0060.02915.06
7.1.290.0100.02614.91
7.1.280.0050.02815.09
7.1.270.0080.02515.07
7.1.260.0040.03015.09
7.1.250.0080.02714.84
7.1.240.0110.02314.87
7.1.230.0060.03014.96
7.1.220.0030.03114.88
7.1.210.0130.02414.76
7.1.200.0080.02914.92
7.1.190.0100.02714.93
7.1.180.0100.02414.80
7.1.170.0050.03114.79
7.1.160.0040.03114.73
7.1.150.0080.03214.89
7.1.140.0090.02614.87
7.1.130.0080.02614.80
7.1.120.0090.03014.73
7.1.110.0110.02614.98
7.1.100.0140.02314.79
7.1.90.0080.03214.84
7.1.80.0070.02914.90
7.1.70.0080.02415.57
7.1.60.0110.03516.43
7.1.50.0120.02715.52
7.1.40.0140.02314.80
7.1.30.0070.02814.82
7.1.20.0070.03114.79
7.1.10.0090.03314.81
7.1.00.0090.04717.23
7.0.330.0070.02614.48
7.0.320.0090.02614.46
7.0.310.0120.02614.27
7.0.300.0050.03014.45
7.0.290.0070.02514.42
7.0.280.0100.03514.38
7.0.270.0030.03114.53
7.0.260.0050.03214.38
7.0.250.0100.02814.48
7.0.240.0100.02514.41
7.0.230.0080.03214.60
7.0.220.0100.02614.62
7.0.210.0070.02814.48
7.0.200.0070.03115.22
7.0.190.0110.02614.51
7.0.180.0090.03114.60
7.0.170.0080.02814.53
7.0.160.0070.03814.36
7.0.150.0070.03314.46
7.0.140.0080.04817.09
7.0.130.0120.03114.55
7.0.120.0090.02814.35
7.0.110.0070.02714.22
7.0.100.0040.03214.55
7.0.90.0070.02714.60
7.0.80.0120.02314.47
7.0.70.0090.03114.55
7.0.60.0080.04316.33
7.0.50.0120.03615.68
7.0.40.0070.03615.75
7.0.30.0190.03315.73
7.0.20.0080.04615.76
7.0.10.0130.03915.72
7.0.00.0070.05515.76
5.6.400.0100.04214.22
5.6.390.0090.04314.34
5.6.380.0070.04914.04
5.6.370.0050.04714.36
5.6.360.0050.04814.13
5.6.350.0080.05114.10
5.6.340.0130.04414.35
5.6.330.0070.04414.39
5.6.320.0120.04414.35
5.6.310.0120.05014.37
5.6.300.0110.04114.14
5.6.290.0090.04514.13
5.6.280.0070.04714.30
5.6.270.0110.04514.52
5.6.260.0140.04214.52
5.6.250.0110.04214.19
5.6.240.0070.04614.14
5.6.230.0040.05114.27
5.6.220.0090.04614.24
5.6.210.0110.07616.35
5.6.200.0110.06715.58
5.6.190.0070.05316.32
5.6.180.1410.05216.40
5.6.170.0130.05716.37
5.6.160.0120.05016.28
5.6.150.0030.05115.65
5.6.140.0100.06015.43
5.6.130.0090.06515.55
5.6.120.0080.06216.46
5.6.110.0120.06216.49
5.6.100.0060.06416.51
5.6.90.0090.06916.64
5.6.80.0040.06916.16
5.6.70.1470.04616.25
5.6.60.0060.04514.26
5.6.50.0070.04414.42
5.6.40.0080.04114.27
5.6.30.0040.04614.22
5.6.20.0070.05414.14
5.6.10.0030.05114.15
5.6.00.0060.04314.25
5.5.380.0050.04514.30
5.5.370.0110.04814.42
5.5.360.0100.04614.25
5.5.350.0090.06616.32
5.5.340.0090.07815.55
5.5.330.0120.05216.24
5.5.320.0150.06516.43
5.5.310.0220.07716.22
5.5.300.0090.06215.51
5.5.290.0020.07615.48
5.5.280.0130.05716.56
5.5.270.0070.05316.23
5.5.260.0100.05316.46
5.5.250.0100.06116.40
5.5.240.0080.06816.29
5.5.230.0080.04814.17
5.5.220.0070.05114.20
5.5.210.0080.04514.28
5.5.200.0150.04114.36
5.5.190.0060.04614.17
5.5.180.0070.04414.33
5.5.170.0030.04814.16
5.5.160.0110.04614.21
5.5.150.0070.04414.35
5.5.140.0090.04714.47
5.5.130.0090.04913.87
5.5.120.0130.04114.21
5.5.110.0100.05114.19
5.5.100.0070.04614.18
5.5.90.0100.04414.04
5.5.80.0070.04513.99
5.5.70.0100.04214.06
5.5.60.0130.04314.31
5.5.50.0140.04614.31
5.5.40.0100.04414.18
5.5.30.0140.03514.19
5.5.20.0110.04313.94
5.5.10.0090.04714.26
5.5.00.0080.04914.04
5.4.450.0140.05914.93
5.4.440.0460.04514.86
5.4.430.0140.05114.85
5.4.420.0180.05414.89
5.4.410.0050.07214.65
5.4.400.0030.07414.68
5.4.390.0080.05714.61
5.4.380.0100.05614.69
5.4.370.0080.06414.63
5.4.360.0110.06014.69
5.4.350.0110.06114.68
5.4.340.0060.06214.60
5.4.330.0100.04612.63
5.4.320.0090.04612.59
5.4.310.0080.05012.59
5.4.300.0060.05112.59
5.4.290.0080.05512.59
5.4.280.0070.05112.56
5.4.270.0090.05312.55
5.4.260.0030.05612.55
5.4.250.0060.06112.55
5.4.240.0070.05012.55
5.4.230.0050.06112.55
5.4.220.0100.04912.54
5.4.210.0080.05812.54
5.4.200.0060.05312.55
5.4.190.0110.05012.54
5.4.180.0050.05412.54
5.4.170.0080.05212.55
5.4.160.0070.06012.55
5.4.150.0080.05212.54
5.4.140.0080.05112.44
5.4.130.0050.05512.44
5.4.120.0080.05312.42
5.4.110.0060.05712.42
5.4.100.0080.05012.42
5.4.90.0080.05412.42
5.4.80.0070.05612.42
5.4.70.0070.05212.42
5.4.60.0070.05612.42
5.4.50.0070.05112.42
5.4.40.0040.05112.42
5.4.30.0060.05012.41
5.4.20.0090.05212.42
5.4.10.0080.05412.41
5.4.00.0060.05712.24
5.3.290.0070.02112.69
5.3.280.0060.02012.66
5.3.270.0060.01812.67
5.3.260.0070.01912.66
5.3.250.0060.01712.66
5.3.240.0050.01712.66
5.3.230.0090.02012.66
5.3.220.0070.01712.65
5.3.210.0060.01612.65
5.3.200.0090.01412.65
5.3.190.0070.01512.65
5.3.180.0070.01512.65
5.3.170.0080.01512.65
5.3.160.0070.01512.65
5.3.150.0040.01712.65
5.3.140.0050.01712.64
5.3.130.0060.01812.64
5.3.120.0110.02012.64
5.3.110.0080.01312.64
5.3.100.0050.01612.46
5.3.90.0060.01412.45
5.3.80.0070.01512.45
5.3.70.0080.01412.45
5.3.60.0060.01612.45
5.3.50.0060.01812.42
5.3.40.0060.01812.42
5.3.30.0050.01612.41
5.3.20.0080.01412.34
5.3.10.0070.01612.33
5.3.00.0100.01312.32
5.2.170.0010.02410.93
5.2.160.0060.01610.93
5.2.150.0040.01810.93
5.2.140.0070.01610.92
5.2.130.0040.01810.90
5.2.120.0090.01610.91
5.2.110.0090.01410.91
5.2.100.0080.01510.91
5.2.90.0050.01710.91
5.2.80.0060.01910.90
5.2.70.0070.01710.90
5.2.60.0080.01510.88
5.2.50.0080.01510.87
5.2.40.0050.01710.85
5.2.30.0070.01610.84
5.2.20.0060.01510.83
5.2.10.0070.01710.80
5.2.00.0040.01910.72
5.1.60.0050.01810.37
5.1.50.0050.01810.37
5.1.40.0040.01810.36
5.1.30.0050.01710.53
5.1.20.0070.01510.55
5.1.10.0060.01310.41
5.1.00.0040.01510.41
5.0.50.0050.0109.65
5.0.40.0040.0139.58
5.0.30.0040.0169.48
5.0.20.0050.0139.47
5.0.10.0050.0129.46
5.0.00.0050.0159.45
4.4.90.0040.0098.74
4.4.80.0050.0088.73
4.4.70.0040.0088.73
4.4.60.0030.0098.73
4.4.50.0000.0138.74
4.4.40.0050.0138.71
4.4.30.0040.0098.73
4.4.20.0030.0098.77
4.4.10.0040.0098.78
4.4.00.0020.0168.73
4.3.110.0020.0098.69
4.3.100.0060.0088.68
4.3.90.0040.0098.67
4.3.80.0040.0138.64
4.3.70.0030.0088.67
4.3.60.0030.0098.66
4.3.50.0040.0078.67
4.3.40.0050.0128.62
4.3.30.0010.0117.99
4.3.20.0030.0097.98
4.3.10.0020.0097.96
4.3.00.0060.01012.99

preferences:
41.81 ms | 401 KiB | 5 Q