3v4l.org

run code in 300+ PHP versions simultaneously
<?php class salutations { public function hello() { return "Hello World!"; } } class methodFactory { public function __construct($instance) { $this->package = $instance; } public function getPackageMethod($method) { if (method_exists($this->package, $method)) { $f = function($method) { return $this->package->$method; }; Closure::bind($f, $this->package, 'salutations'); return $f; } } } $salutationsInstance = new salutations(); $obj = new methodFactory($salutationsInstance); $hello = $obj->getPackageMethod('hello'); $hello();

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.0070.01516.88
8.3.50.0190.00821.08
8.3.40.0120.00318.90
8.3.30.0080.00618.94
8.3.20.0040.00420.34
8.3.10.0040.00421.85
8.3.00.0040.00418.04
8.2.180.0120.00318.41
8.2.170.0110.00322.96
8.2.160.0030.01020.53
8.2.150.0000.00924.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0060.00317.50
8.2.110.0060.00320.47
8.2.100.0110.00017.88
8.2.90.0050.00319.05
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0070.00317.93
8.2.50.0040.00418.07
8.2.40.0040.00421.19
8.2.30.0040.00420.57
8.2.20.0040.00417.72
8.2.10.0050.00317.95
8.2.00.0000.00718.08
8.1.280.0030.01225.92
8.1.270.0080.00023.81
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00323.78
8.1.230.0060.00623.88
8.1.220.0090.00017.74
8.1.210.0040.00418.77
8.1.200.0080.00017.35
8.1.190.0080.00017.22
8.1.180.0030.00618.10
8.1.170.0040.00420.25
8.1.160.0070.00022.04
8.1.150.0080.00018.97
8.1.140.0090.00019.51
8.1.130.0030.00317.63
8.1.120.0000.00817.40
8.1.110.0080.00017.40
8.1.100.0000.00717.45
8.1.90.0030.00317.38
8.1.80.0030.00517.51
8.1.70.0000.00717.35
8.1.60.0040.00417.61
8.1.50.0030.00617.54
8.1.40.0030.00517.54
8.1.30.0040.00417.70
8.1.20.0030.00517.71
8.1.10.0060.00317.64
8.1.00.0040.00417.51
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.31
8.0.270.0040.00417.21
8.0.260.0030.00317.29
8.0.250.0040.00416.86
8.0.240.0030.00616.88
8.0.230.0030.00317.04
8.0.220.0040.00416.94
8.0.210.0040.00416.92
8.0.200.0000.00616.96
8.0.190.0040.00417.02
8.0.180.0040.00416.97
8.0.170.0050.00317.01
8.0.160.0030.00416.98
8.0.150.0040.00416.81
8.0.140.0000.00716.83
8.0.130.0030.00313.38
8.0.120.0000.00816.95
8.0.110.0030.00516.98
8.0.100.0050.00316.97
8.0.90.0070.00017.01
8.0.80.0170.00516.91
8.0.70.0000.00817.02
8.0.60.0000.00816.96
8.0.50.0040.00416.96
8.0.30.0080.01117.34
8.0.20.0090.01117.41
8.0.10.0000.00817.14
8.0.00.0130.00616.77
7.4.330.0000.00515.16
7.4.320.0000.00716.51
7.4.300.0050.00316.52
7.4.290.0030.00316.52
7.4.280.0030.00916.56
7.4.270.0070.00016.51
7.4.260.0030.00316.49
7.4.250.0000.00716.52
7.4.240.0040.00316.49
7.4.230.0040.00216.70
7.4.220.0090.01616.66
7.4.210.0090.00616.54
7.4.200.0000.00716.60
7.4.160.0080.01216.61
7.4.150.0090.00917.40
7.4.140.0090.01117.86
7.4.130.0040.01516.67
7.4.120.0080.01316.49
7.4.110.0000.01916.53
7.4.100.0100.00616.48
7.4.90.0100.00716.64
7.4.80.0070.01419.39
7.4.70.0030.01616.48
7.4.60.0030.01316.34
7.4.50.0060.00316.55
7.4.40.0170.00016.46
7.4.30.0030.01716.50
7.4.00.0070.01015.19
7.3.330.0030.00313.44
7.3.320.0000.00513.40
7.3.310.0000.00816.42
7.3.300.0000.00716.25
7.3.290.0060.00916.32
7.3.280.0110.00916.33
7.3.270.0070.01017.40
7.3.260.0070.01016.46
7.3.240.0080.01116.51
7.3.230.0060.01216.39
7.3.210.0140.00316.45
7.3.200.0040.01416.64
7.3.190.0100.01016.36
7.3.180.0120.00316.35
7.3.170.0100.00616.41
7.3.160.0080.00916.43
7.2.330.0140.00716.77
7.2.320.0070.01016.78
7.2.310.0100.00716.36
7.2.300.0050.01016.41
7.2.290.0080.01116.66
7.2.60.0140.00016.88
7.2.00.0030.00919.39
7.1.200.0090.00615.70
7.1.100.0000.01118.14
7.1.70.0140.00717.24
7.1.60.0070.01519.50
7.1.50.0030.01716.88
7.1.00.0030.07722.45
7.0.200.0040.00416.92
7.0.60.0030.09019.95
7.0.50.0070.08017.88
7.0.40.0070.08720.22
7.0.30.0170.04020.12
7.0.20.0270.05720.12
7.0.10.0030.05720.37
7.0.00.0030.06020.20
5.6.280.0000.07321.05
5.6.210.0130.05720.60
5.6.200.0130.07318.18
5.6.190.0000.04720.50
5.6.180.0300.06720.43
5.6.170.0170.04720.48
5.6.160.0000.06320.61
5.6.150.0070.03718.27
5.6.140.0130.05718.16
5.6.130.0070.08318.24
5.6.120.0130.08320.99
5.6.110.0030.04021.02
5.6.100.0100.07021.12
5.6.90.0000.08321.01
5.6.80.0100.06020.30
5.5.350.0030.07320.45
5.5.340.0070.07718.09
5.5.330.0000.05720.43
5.5.320.4000.03320.20
5.5.310.0300.05020.30
5.5.300.0130.07317.95
5.5.290.0100.04717.97
5.5.280.0030.06721.00
5.5.270.0130.08020.98
5.5.260.0200.07320.88
5.5.250.0130.07320.70
5.5.240.0030.07020.30
5.4.450.0630.06319.62
5.4.440.0800.05019.46
5.4.430.0670.05319.60
5.4.420.0670.05319.51
5.4.410.0630.05719.00
5.4.400.0870.06319.26
5.4.390.0670.05319.14
5.4.380.0600.05719.25
5.4.370.0730.04719.02
5.4.360.0600.06019.20
5.4.350.0600.05719.02
5.4.340.0630.05719.12
5.4.320.0830.05319.16
5.4.310.0670.06019.14
5.4.300.0630.05719.29
5.4.290.0630.06019.13
5.4.280.0670.05719.13
5.4.270.0770.04319.14
5.4.260.0700.05319.11
5.4.250.0830.04319.25
5.4.240.0630.05719.13
5.4.230.0630.06019.25
5.4.220.0770.05318.84
5.4.210.0670.06019.25
5.4.200.0730.04718.95
5.4.190.0700.05019.18
5.4.180.0700.05018.85
5.4.170.0800.06719.23
5.4.160.0730.05319.23
5.4.150.0630.05719.24
5.4.140.0630.06316.49
5.4.130.0700.05316.49
5.4.120.0700.05716.63
5.4.110.0700.05316.65
5.4.100.0700.05016.62
5.4.90.0730.05016.66
5.4.80.0700.06316.55
5.4.70.0670.05316.55
5.4.60.0700.05016.59
5.4.50.0800.05716.50
5.4.40.0800.05716.57
5.4.30.0770.04316.59
5.4.20.0830.05316.54
5.4.10.0770.05716.49
5.4.00.0700.05015.79

preferences:
64.3 ms | 401 KiB | 5 Q