3v4l.org

run code in 300+ PHP versions simultaneously
<?php // objects, closures, stdClass, clone $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"; }; $obj1->getClosure = function() { return $obj1->getEveningMessage; }; $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->getClosure; echo $first(); echo call_user_func($first); echo $obj1->getClosure->__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.0070.01418.43
8.3.50.0120.00421.20
8.3.40.0140.00718.66
8.3.30.0070.00720.17
8.3.20.0040.00420.29
8.3.10.0040.00421.08
8.3.00.0080.00022.50
8.2.180.0120.00916.61
8.2.170.0110.00322.96
8.2.160.0100.00322.17
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0050.00226.16
8.2.120.0070.00720.82
8.2.110.0090.00021.12
8.2.100.0120.00417.68
8.2.90.0000.00819.25
8.2.80.0080.00017.97
8.2.70.0000.00817.63
8.2.60.0080.00017.93
8.2.50.0000.00818.07
8.2.40.0060.00318.35
8.2.30.0020.00518.20
8.2.20.0040.00417.80
8.2.10.0050.00317.82
8.2.00.0040.00417.64
8.1.280.0090.00625.92
8.1.270.0080.00023.99
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0060.00321.25
8.1.230.0080.00418.93
8.1.220.0060.00317.79
8.1.210.0050.00318.77
8.1.200.0000.01017.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0040.00418.72
8.1.160.0000.00718.83
8.1.150.0020.00518.66
8.1.140.0050.00217.51
8.1.130.0030.00317.85
8.1.120.0020.00517.45
8.1.110.0000.00817.45
8.1.100.0000.00717.51
8.1.90.0050.00317.37
8.1.80.0040.00417.48
8.1.70.0070.00017.41
8.1.60.0090.00017.62
8.1.50.0000.00817.43
8.1.40.0000.00817.50
8.1.30.0080.00017.67
8.1.20.0000.00817.56
8.1.10.0040.00417.47
8.1.00.0040.00417.41
8.0.300.0050.00318.77
8.0.290.0080.00316.75
8.0.280.0030.00318.38
8.0.270.0070.00017.27
8.0.260.0030.00316.77
8.0.250.0070.00017.05
8.0.240.0040.00417.02
8.0.230.0030.00316.92
8.0.220.0000.00716.82
8.0.210.0070.00016.75
8.0.200.0060.00016.91
8.0.190.0040.00416.95
8.0.180.0000.00716.90
8.0.170.0030.00616.93
8.0.160.0030.00317.03
8.0.150.0030.00516.91
8.0.140.0000.00916.83
8.0.130.0000.00513.44
8.0.120.0040.00416.82
8.0.110.0040.00416.79
8.0.100.0040.00316.91
8.0.90.0070.00016.95
8.0.80.0000.01517.00
8.0.70.0040.00417.01
8.0.60.0000.00716.89
8.0.50.0070.00016.82
8.0.30.0100.00917.30
8.0.20.0060.01317.40
8.0.10.0040.00417.11
8.0.00.0050.01316.75
7.4.330.0000.00516.83
7.4.320.0000.00616.61
7.4.300.0060.00016.63
7.4.290.0070.00016.44
7.4.280.0000.00716.47
7.4.270.0000.00716.61
7.4.260.0060.00013.15
7.4.250.0040.00416.58
7.4.240.0030.00316.38
7.4.230.0030.00316.72
7.4.220.0120.00616.54
7.4.210.0080.00616.50
7.4.200.0000.00716.64
7.4.190.0070.00016.49
7.4.160.0090.01216.45
7.4.150.0120.00617.40
7.4.140.0060.01217.86
7.4.130.0120.00816.53
7.4.120.0090.00916.64
7.4.110.0100.00716.64
7.4.100.0090.00916.65
7.4.90.0110.00916.58
7.4.80.0160.00619.39
7.4.70.0110.00716.60
7.4.60.0130.00916.56
7.4.50.0080.00016.36
7.4.40.0070.01022.77
7.4.30.0060.01216.23
7.4.00.0070.01014.79
7.3.330.0030.00313.25
7.3.320.0020.00213.25
7.3.310.0000.00816.25
7.3.300.0070.00016.30
7.3.290.0100.00716.44
7.3.280.0100.00716.39
7.3.270.0090.00817.40
7.3.260.0130.00618.24
7.3.250.0120.01116.48
7.3.240.0060.01216.62
7.3.230.0060.00916.39
7.3.210.0070.01016.39
7.3.200.0150.00916.54
7.3.190.0080.00816.62
7.3.180.0120.00916.43
7.3.170.0150.00016.52
7.3.160.0100.00716.49
7.3.120.0070.01015.05
7.2.330.0090.00916.45
7.2.320.0170.00016.52
7.2.310.0090.00916.75
7.2.300.0090.01216.52
7.2.290.0180.00016.48
7.2.60.0000.01216.89
7.2.00.0000.01219.63
7.1.200.0060.00615.96
7.1.100.0070.01118.34
7.1.70.0060.00617.27
7.1.60.0030.02019.17
7.1.50.0200.00734.49
7.1.00.0030.03322.51
7.0.200.0030.00516.78
7.0.140.0000.07321.95
7.0.100.0130.07320.00
7.0.90.0030.09019.91
7.0.80.0170.07019.88
7.0.70.0070.07020.14
7.0.60.0130.07019.89
7.0.50.0100.08020.31
7.0.40.0100.07720.15
7.0.30.0070.08020.16
7.0.20.0130.08020.09
7.0.10.0170.08020.07
7.0.00.0100.07320.03
5.6.280.0030.07320.87
5.6.250.0130.07320.63
5.6.240.0070.08020.70
5.6.230.0070.09020.66
5.6.220.0100.04320.67
5.6.210.0170.07020.67
5.6.200.0030.09021.06
5.6.190.0070.08721.08
5.6.180.0030.08721.14
5.6.170.0070.04320.95
5.6.160.0130.07021.11
5.6.150.0170.07321.06
5.6.140.0230.04320.97
5.6.130.0030.04721.02
5.6.120.0000.08021.05
5.6.110.0000.05020.95
5.6.100.0000.05020.93
5.6.90.0200.03721.05
5.6.80.0100.06020.36
5.6.70.0100.06320.32
5.6.60.0070.07020.41
5.6.50.0130.07320.43
5.6.40.0030.08320.53
5.6.30.0030.07320.30
5.6.20.0030.05320.44
5.6.10.0070.06720.47
5.6.00.0100.07320.33
5.5.380.0100.06020.43
5.5.370.0070.07320.39
5.5.360.0130.07020.41
5.5.350.0030.04720.46
5.5.340.0070.08320.89
5.5.330.0070.07020.65
5.5.320.0100.04020.65
5.5.310.0070.06020.79
5.5.300.0030.06020.88
5.5.290.0030.07320.80
5.5.280.0130.08720.73
5.5.270.0070.07320.89
5.5.260.0030.08720.77
5.5.250.0030.07720.66
5.5.240.0130.06320.13
5.5.230.0000.05020.02
5.5.220.0200.03720.24
5.5.210.0070.07720.21
5.5.200.0000.08320.20
5.5.190.0100.07320.18
5.5.180.0030.07720.28
5.5.160.0030.06320.12
5.5.150.0030.06320.24
5.5.140.0130.04720.18
5.5.130.0030.04720.11
5.5.120.0070.03720.09
5.5.110.0000.05020.24
5.5.100.0070.03719.98
5.5.90.0000.04720.12
5.5.80.0100.03020.16
5.5.70.0070.04719.94
5.5.60.0000.04319.94
5.5.50.0000.03720.04
5.5.40.0070.03720.01
5.5.30.0070.03020.16
5.5.20.0030.04020.00
5.5.10.0130.02720.02
5.5.00.0070.03720.05
5.4.450.0070.07719.46
5.4.440.0100.07719.36
5.4.430.0100.07319.38
5.4.420.0100.04319.45
5.4.410.0000.05319.23
5.4.400.0030.06319.09
5.4.390.0130.07719.23
5.4.380.0030.04318.96
5.4.370.0070.06018.88
5.4.360.0130.04319.17
5.4.350.0130.07018.88
5.4.340.0000.08319.18
5.4.320.0000.08018.84
5.4.310.0000.07019.12
5.4.300.0100.03719.09
5.4.290.0130.05318.84
5.4.280.0000.04019.14
5.4.270.0000.04019.13
5.4.260.0070.04018.90
5.4.250.0070.03319.16
5.4.240.0030.03719.09
5.4.230.0070.03718.90
5.4.220.0030.04019.16
5.4.210.0030.03719.22
5.4.200.0000.04019.08
5.4.190.0030.04019.03
5.4.180.0000.04018.84
5.4.170.0000.04318.89
5.4.160.0130.02719.02
5.4.150.0070.04318.80
5.4.140.0000.03716.50
5.4.130.0030.03716.18
5.4.120.0000.04016.38
5.4.110.0030.03016.52
5.4.100.0030.03316.56
5.4.90.0000.03016.54
5.4.80.0000.03316.43
5.4.70.0070.02716.54
5.4.60.0100.04316.40
5.4.50.0000.03016.33
5.4.40.0030.03016.30
5.4.30.0070.02716.45
5.4.20.0030.03716.43
5.4.10.0000.03716.25
5.4.00.0030.02715.77
5.3.290.0130.07315.70
5.3.280.0070.03715.70
5.3.270.0000.04315.70
5.3.260.0000.03715.70
5.3.250.0030.03315.70
5.3.240.0000.04015.70
5.3.230.0070.03715.70
5.3.220.0030.03715.70
5.3.210.0030.04015.70
5.3.200.0070.03315.70
5.3.190.0070.02715.70
5.3.180.0130.02715.70
5.3.170.0030.03715.70
5.3.160.0030.03715.70
5.3.150.0030.03315.70
5.3.140.0100.03015.70
5.3.130.0130.02315.70
5.3.120.0070.03015.70
5.3.110.0000.03315.70
5.3.100.0070.02715.70
5.3.90.0070.02715.70
5.3.80.0030.03015.70
5.3.70.0070.02715.70
5.3.60.0000.03315.70
5.3.50.0000.03315.70
5.3.40.0070.02715.70
5.3.30.0030.03315.70
5.3.20.0100.02015.70
5.3.10.0100.06715.70
5.3.00.0130.06315.70
5.2.170.0000.02715.70
5.2.160.0000.02715.70
5.2.150.0000.02715.70
5.2.140.0000.02715.70
5.2.130.0030.02315.70
5.2.120.0000.03315.70
5.2.110.0030.06315.70
5.2.100.0070.06015.70
5.2.90.0100.05715.70
5.2.80.0030.05015.70
5.2.70.0030.06315.70
5.2.60.0000.02715.70
5.2.50.0100.04015.70
5.2.40.0000.04315.70
5.2.30.0030.04715.70
5.2.20.0130.03315.70
5.2.10.0000.03315.70
5.2.00.0030.05715.70
5.1.60.0030.04315.70
5.1.50.0070.05015.70
5.1.40.0070.04715.70
5.1.30.0030.05715.70
5.1.20.0000.06015.70
5.1.10.0070.05315.70
5.1.00.0070.05315.70
5.0.50.0030.04315.70
5.0.40.0030.04715.70
5.0.30.0000.06315.70
5.0.20.0070.04015.70
5.0.10.0070.02315.70
5.0.00.0070.06715.70
4.4.90.0030.02315.70
4.4.80.0070.03015.70
4.4.70.0030.03315.70
4.4.60.0000.03715.70
4.4.50.0000.03015.70
4.4.40.0000.05315.70
4.4.30.0000.04015.70
4.4.20.0000.03715.70
4.4.10.0030.03015.70
4.4.00.0070.04315.70
4.3.110.0030.03315.70
4.3.100.0070.03015.70
4.3.90.0000.03015.70
4.3.80.0000.04715.70
4.3.70.0000.03315.70
4.3.60.0030.03715.70
4.3.50.0030.01715.70
4.3.40.0000.05315.70
4.3.30.0000.01715.70
4.3.20.0030.02015.70
4.3.10.0000.03015.70
4.3.00.0000.03315.70

preferences:
46.8 ms | 401 KiB | 5 Q