3v4l.org

run code in 300+ PHP versions simultaneously
<?php // objects, closures, stdClass, clone and why we need function chaining $closures = array(); $simple_closure = function() { return $this->msg;}; for ($x=0; $x < 2; $x++) { $closures[$x] = $simple_closure; } $obj1 = new stdClass; $obj1->msg = "Top of the morning\n"; $obj1->getEveningMessage = function () { return "Some enchanted and lovely summer evening ...\n"; }; $obj2 = clone($obj1); $obj2->msg = "Happy Days!\n"; $c1 = Closure::bind($closures[0], $obj1); $c2 = Closure::bind($closures[1], $obj2); echo $c1(); echo $c2(); $first = $obj1->getEveningMessage; echo $first(); echo call_user_func($obj1->getEveningMessage); echo $obj2->getEveningMessage->__invoke();

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.0140.00418.30
8.3.50.0120.00321.07
8.3.40.0150.00018.97
8.3.30.0140.00020.20
8.3.20.0050.00320.21
8.3.10.0000.00821.04
8.3.00.0080.00022.54
8.2.180.0140.00316.50
8.2.170.0070.01122.96
8.2.160.0100.00722.08
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00021.04
8.2.110.0040.00722.11
8.2.100.0090.00317.91
8.2.90.0080.00019.34
8.2.80.0030.00617.97
8.2.70.0050.00317.63
8.2.60.0000.00817.93
8.2.50.0000.00818.07
8.2.40.0050.00318.19
8.2.30.0030.00319.45
8.2.20.0040.00417.80
8.2.10.0000.00717.76
8.2.00.0060.00317.74
8.1.280.0000.01625.92
8.1.270.0070.00023.99
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0100.00021.28
8.1.230.0000.01117.42
8.1.220.0040.00417.79
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0000.00817.23
8.1.180.0030.00618.10
8.1.170.0060.00318.65
8.1.160.0070.00018.92
8.1.150.0000.00818.66
8.1.140.0040.00417.46
8.1.130.0070.00017.76
8.1.120.0000.00717.44
8.1.110.0040.00417.43
8.1.100.0000.00817.36
8.1.90.0050.00317.48
8.1.80.0030.00417.43
8.1.70.0000.00717.41
8.1.60.0000.00817.45
8.1.50.0080.00017.44
8.1.40.0070.00017.53
8.1.30.0000.00717.68
8.1.20.0000.00817.54
8.1.10.0000.00817.50
8.1.00.0000.00717.60
8.0.300.0030.00918.77
8.0.290.0050.00216.75
8.0.280.0040.00418.47
8.0.270.0000.00717.18
8.0.260.0000.00716.83
8.0.250.0040.00416.88
8.0.240.0000.00916.85
8.0.230.0000.00716.83
8.0.220.0000.00716.89
8.0.210.0000.00716.84
8.0.200.0030.00316.95
8.0.190.0000.00817.01
8.0.180.0050.00316.81
8.0.170.0080.00016.85
8.0.160.0000.00716.82
8.0.150.0080.00016.80
8.0.140.0060.00316.88
8.0.130.0060.00013.31
8.0.120.0080.00016.89
8.0.110.0080.00016.94
8.0.100.0000.00716.86
8.0.90.0040.00416.75
8.0.80.0040.01116.87
8.0.70.0020.00516.79
8.0.60.0040.00416.96
8.0.50.0040.00416.78
8.0.30.0090.00917.14
8.0.20.0120.00617.40
8.0.10.0000.00716.98
8.0.00.0080.00816.62
7.4.330.0050.00016.73
7.4.320.0060.00016.57
7.4.300.0030.00316.61
7.4.290.0070.00016.51
7.4.280.0000.00816.49
7.4.270.0000.00716.63
7.4.260.0000.00513.29
7.4.250.0000.00716.48
7.4.240.0000.00716.63
7.4.230.0000.00716.70
7.4.220.0030.02116.50
7.4.210.0080.00916.60
7.4.200.0030.00316.68
7.4.190.0030.00316.76
7.4.160.0130.00316.36
7.4.150.0070.01117.40
7.4.140.0140.00517.86
7.4.130.0080.00916.43
7.4.120.0030.01416.62
7.4.110.0060.01016.37
7.4.100.0100.01016.70
7.4.90.0060.01116.57
7.4.80.0080.01419.39
7.4.70.0060.01016.46
7.4.60.0110.01116.63
7.4.50.0000.00816.36
7.4.40.0070.01022.77
7.4.30.0070.01016.72
7.4.00.0080.00515.06
7.3.330.0050.00013.19
7.3.320.0000.00513.23
7.3.310.0030.00316.21
7.3.300.0070.00016.23
7.3.290.0140.00016.34
7.3.280.0100.00716.38
7.3.270.0030.01417.40
7.3.260.0130.00618.24
7.3.250.0050.01516.53
7.3.240.0060.01216.48
7.3.230.0080.00816.65
7.3.210.0080.00816.45
7.3.200.0060.01119.39
7.3.190.0080.00916.33
7.3.180.0100.00716.37
7.3.170.0050.01116.43
7.3.160.0030.01616.32
7.3.120.0080.00715.03
7.3.110.0070.01114.92
7.3.100.0090.00314.87
7.3.90.0000.01014.88
7.3.80.0040.01114.82
7.3.70.0030.00914.81
7.3.60.0080.00314.96
7.3.50.0030.01214.71
7.3.40.0110.00314.58
7.3.30.0100.00314.97
7.3.20.0090.00316.45
7.3.10.0050.00916.63
7.3.00.0040.00616.65
7.2.330.0110.00616.82
7.2.320.0160.00316.83
7.2.310.0070.01716.88
7.2.300.0120.00616.65
7.2.290.0120.00416.90
7.2.250.0090.00915.02
7.2.240.0150.00315.33
7.2.230.0030.00915.04
7.2.220.0000.01415.20
7.2.210.0070.00714.94
7.2.200.0080.00815.36
7.2.190.0040.00814.86
7.2.180.0070.01015.04
7.2.170.0060.00915.13
7.2.130.0050.00816.90
7.2.120.0050.00716.97
7.2.110.0030.00816.88
7.2.100.0030.00817.04
7.2.90.0060.01016.92
7.2.80.0000.01117.02
7.2.70.0030.00716.75
7.2.60.0090.00516.92
7.2.50.0030.00716.91
7.2.40.0030.00816.84
7.2.30.0080.00516.93
7.2.20.0070.00516.99
7.2.10.0070.00316.99
7.2.00.0070.00717.88
7.1.330.0030.01015.78
7.1.320.0040.01115.54
7.1.310.0070.01015.96
7.1.300.0080.00015.80
7.1.290.0060.00315.99
7.1.280.0000.01515.77
7.1.270.0100.00615.96
7.1.260.0040.01115.95
7.1.250.0030.00715.69
7.1.100.0100.01018.27
7.1.70.0080.00017.11
7.1.60.0090.01519.17
7.1.50.0110.01416.75
7.1.00.0000.04022.28
7.0.200.0060.00316.75
7.0.140.0000.07722.12
7.0.110.0200.04019.98
7.0.100.0300.04719.95
7.0.90.0300.04020.09
7.0.80.0170.04019.96
7.0.70.0130.06319.96
7.0.60.0170.04019.90
7.0.50.0430.03720.33
7.0.40.0030.06720.04
7.0.30.0070.08720.27
7.0.20.0100.07020.06
7.0.10.0100.08320.05
7.0.00.0100.08020.25
5.6.280.0030.07021.16
5.6.260.0070.03720.68
5.6.250.0000.04320.59
5.6.240.0100.03720.87
5.6.230.0000.04320.56
5.6.220.0130.03320.64
5.6.210.0030.04720.71
5.6.200.0070.06021.22
5.6.190.0070.04021.15
5.6.180.0070.07721.15
5.6.170.0030.08321.22
5.6.160.0030.05320.95
5.6.150.0070.08021.30
5.6.140.0070.08321.22
5.6.130.0070.07321.09
5.6.120.0030.08321.15
5.6.110.0100.07021.14
5.6.100.0100.08021.05
5.6.90.0070.08021.13
5.6.80.0070.07720.47
5.6.70.0030.08320.30
5.6.60.0130.07020.66
5.6.50.0130.06320.42
5.6.40.0070.07320.39
5.6.30.0130.07020.42
5.6.20.0070.08020.57
5.6.10.0070.06720.37
5.6.00.0130.07320.43
5.5.380.0070.04720.55
5.5.370.0030.04020.30
5.5.360.0000.04320.56
5.5.350.0000.07020.41
5.5.340.0000.07320.82
5.5.330.0000.08720.79
5.5.320.0100.07320.82
5.5.310.0200.06020.75
5.5.300.0000.08321.02
5.5.290.0130.07720.98
5.5.280.0130.07720.98
5.5.270.0130.07721.04
5.5.260.0070.07720.88
5.5.250.0100.07720.63
5.5.240.0100.06320.20
5.5.230.0100.07020.20
5.5.220.0070.07720.28
5.5.210.0100.07720.29
5.5.200.0070.08020.38
5.5.190.0130.07320.17
5.5.180.0070.08020.25
5.5.160.0100.07320.30
5.5.150.0070.07320.25
5.5.140.0000.08720.37
5.5.130.0100.07720.26
5.5.120.0200.06020.22
5.5.110.0130.07320.18
5.5.100.0130.06720.07
5.5.90.0100.07320.27
5.5.80.0070.07720.26
5.5.70.0130.06720.02
5.5.60.0030.07720.16
5.5.50.0100.07020.11
5.5.40.0130.07020.10
5.5.30.0130.07320.02
5.5.20.0070.06320.07
5.5.10.0030.06720.18
5.5.00.0030.04720.04
5.4.450.0070.08319.28
5.4.440.0100.08319.49
5.4.430.0000.08019.63
5.4.420.0030.04019.41
5.4.410.0070.07019.16
5.4.400.0070.08018.95
5.4.390.0030.06719.24
5.4.380.0070.07719.23
5.4.370.0000.08318.99
5.4.360.0100.07019.02
5.4.350.0100.07319.01
5.4.340.0130.07319.17
5.4.320.0100.07319.19
5.4.310.0070.07319.19
5.4.300.0100.07719.31
5.4.290.0070.07719.18
5.4.280.0030.06319.18
5.4.270.0030.08019.14
5.4.260.0070.08019.00
5.4.250.0030.07319.04
5.4.240.0070.07319.30
5.4.230.0130.04019.00
5.4.220.0030.06718.95
5.4.210.0100.07319.13
5.4.200.0000.08018.98
5.4.190.0070.04719.32
5.4.180.0000.08018.99
5.4.170.0130.07718.99
5.4.160.0130.04719.13
5.4.150.0170.07319.15
5.4.140.0070.04716.55
5.4.130.0230.05316.59
5.4.120.0170.06316.63
5.4.110.0200.06016.43
5.4.100.0030.07016.21
5.4.90.0100.07316.59
5.4.80.0100.05716.57
5.4.70.0000.08016.55
5.4.60.0130.05716.41
5.4.50.0130.06716.41
5.4.40.0070.06716.57
5.4.30.0030.07316.48
5.4.20.0070.04316.44
5.4.10.0000.05716.38
5.4.00.0070.06315.78
5.3.290.0100.07014.77
5.3.280.0170.06314.56
5.3.270.0100.06314.70
5.3.260.0070.06714.59
5.3.250.0100.07714.63
5.3.240.0070.07314.62
5.3.230.0100.07314.68
5.3.220.0100.07014.52
5.3.210.0000.04714.43
5.3.200.0070.06014.70
5.3.190.0100.06714.67
5.3.180.0170.07014.66
5.3.170.0100.07314.59
5.3.160.0100.07314.56
5.3.150.0130.06314.56
5.3.140.0030.08014.57
5.3.130.0030.07714.70
5.3.120.0030.05014.59
5.3.110.0070.07314.51
5.3.100.0130.07013.91
5.3.90.0030.06714.15
5.3.80.0100.06714.16
5.3.70.0030.04714.02
5.3.60.0070.07013.97
5.3.50.0000.06313.91
5.3.40.0070.07013.94
5.3.30.0070.03314.06
5.3.20.0030.04713.76
5.3.10.0030.07013.67
5.3.00.0200.03713.72
5.2.170.0170.05011.84
5.2.160.0030.02711.84
5.2.150.0070.04311.84
5.2.140.0100.05711.84
5.2.130.0130.05011.84
5.2.120.0000.03711.84
5.2.110.0070.06311.84
5.2.100.0030.05711.84
5.2.90.0070.05711.84
5.2.80.0070.06311.84
5.2.70.0070.04311.84
5.2.60.0070.04711.84
5.2.50.0070.05711.84
5.2.40.0070.05711.84
5.2.30.0070.06311.84
5.2.20.0000.06011.84
5.2.10.0030.04311.84
5.2.00.0100.05311.84
5.1.60.0030.05311.84
5.1.50.0070.05311.84
5.1.40.0000.05311.84
5.1.30.0030.05711.84
5.1.20.0030.05311.84
5.1.10.0000.06011.84
5.1.00.0030.05311.84
5.0.50.0030.04711.84
5.0.40.0000.04711.84
5.0.30.0030.06711.84
5.0.20.0030.03711.84
5.0.10.0030.04311.84
5.0.00.0070.06311.84
4.4.90.0000.02711.84
4.4.80.0070.03311.84
4.4.70.0000.03711.84
4.4.60.0000.03711.84
4.4.50.0030.03311.84
4.4.40.0070.05011.84
4.4.30.0030.03311.84
4.4.20.0070.03011.84
4.4.10.0000.03711.84
4.4.00.0030.05711.84
4.3.110.0030.02011.84
4.3.100.0030.03711.84
4.3.90.0000.03311.84
4.3.80.0030.04711.84
4.3.70.0070.03011.84
4.3.60.0030.03311.84
4.3.50.0070.03011.84
4.3.40.0000.04311.84
4.3.30.0000.03711.84
4.3.20.0000.04011.84
4.3.10.0000.03011.84
4.3.00.0030.03711.84

preferences:
64.89 ms | 401 KiB | 5 Q