3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $name; public function __construct($name) { $this->name = $name; } } // test callable function getName() { return $this->name; } $bob = new A("Bob"); $cl1 = Closure::fromCallable("getName"); $cl1 = $cl1->bindTo($bob, 'A'); //This will retrieve: Uncaught Error: Cannot access private property A::$name $result = $cl1(); echo $result; //But for a Lambda function $cl2 = function() { return $this->name; }; $cl2 = $cl2->bindTo($bob, 'A'); $result = $cl2(); // This will print Bob echo $result;

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.0080.00816.75
8.3.50.0140.00318.18
8.3.40.0070.01118.79
8.3.30.0100.00718.63
8.3.20.0040.01121.89
8.3.10.0050.00223.61
8.3.00.0100.00317.77
8.2.180.0040.01118.54
8.2.170.0030.01622.96
8.2.160.0100.00319.29
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0030.00620.40
8.2.120.0040.00426.35
8.2.110.0030.00622.31
8.2.100.0000.01117.78
8.2.90.0050.00319.05
8.2.80.0030.00517.97
8.2.70.0030.00517.59
8.2.60.0000.00917.80
8.2.50.0080.00018.10
8.2.40.0050.00320.60
8.2.30.0050.00320.91
8.2.20.0000.00717.95
8.2.10.0000.00717.99
8.2.00.0000.00817.99
8.1.280.0080.00625.92
8.1.270.0040.00420.66
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00323.79
8.1.230.0040.00822.15
8.1.220.0060.00317.74
8.1.210.0030.00618.77
8.1.200.0070.00317.36
8.1.190.0030.00517.13
8.1.180.0100.00018.10
8.1.170.0000.00818.36
8.1.160.0060.00318.87
8.1.150.0040.00418.89
8.1.140.0050.00219.54
8.1.130.0080.00018.70
8.1.120.0000.00717.45
8.1.110.0020.00517.41
8.1.100.0040.00417.39
8.1.90.0000.00717.30
8.1.80.0070.00017.36
8.1.70.0000.00717.41
8.1.60.0040.00417.48
8.1.50.0080.00017.41
8.1.40.0000.00817.56
8.1.30.0040.00417.59
8.1.20.0000.00717.68
8.1.10.0040.00417.57
8.1.00.0000.00717.50
8.0.300.0050.00218.77
8.0.290.0050.00316.63
8.0.280.0000.00718.37
8.0.270.0000.00717.18
8.0.260.0030.00317.17
8.0.250.0000.00716.93
8.0.240.0000.00916.84
8.0.230.0000.00716.99
8.0.220.0030.00316.95
8.0.210.0040.00416.77
8.0.200.0000.00616.92
8.0.190.0030.00816.93
8.0.180.0000.00716.88
8.0.170.0040.00416.80
8.0.160.0070.00016.73
8.0.150.0070.00016.80
8.0.140.0030.00516.70
8.0.130.0060.00013.31
8.0.120.0000.00716.88
8.0.110.0000.00717.00
8.0.100.0000.00916.77
8.0.90.0040.00416.95
8.0.80.0060.01216.87
8.0.70.0040.00416.75
8.0.60.0040.00416.94
8.0.50.0000.00816.90
8.0.30.0090.00916.97
8.0.20.0110.00917.40
8.0.10.0070.00016.80
8.0.00.0160.00316.72
7.4.330.0020.00215.55
7.4.320.0060.00016.55
7.4.300.0050.00216.64
7.4.290.0000.00816.60
7.4.280.0040.00416.44
7.4.270.0030.00316.60
7.4.260.0060.00316.59
7.4.250.0000.00816.49
7.4.240.0070.00016.49
7.4.230.0030.00316.35
7.4.220.0130.01116.63
7.4.210.0070.01316.46
7.4.200.0000.00716.52
7.4.160.0120.00316.36
7.4.150.0070.01117.40
7.4.140.0130.00517.86
7.4.130.0060.01816.55
7.4.120.0120.01116.51
7.4.110.0100.01316.57
7.4.100.0070.01016.47
7.4.90.0060.01216.62
7.4.80.0080.00919.39
7.4.70.0100.01316.45
7.4.60.0060.01016.48
7.4.50.0100.00716.24
7.4.40.0140.00316.54
7.4.30.0000.01816.46
7.4.00.0030.01314.99
7.3.330.0000.00613.32
7.3.320.0050.00013.33
7.3.310.0000.00716.38
7.3.300.0070.00016.23
7.3.290.0060.00816.34
7.3.280.0070.01116.35
7.3.270.0110.00717.40
7.3.260.0090.01216.34
7.3.250.0120.00716.40
7.3.240.0080.00816.45
7.3.230.0080.00816.54
7.3.210.0090.00616.29
7.3.200.0090.01216.29
7.3.190.0160.00316.54
7.3.180.0130.00716.38
7.3.170.0110.01016.37
7.3.160.0040.01116.41
7.2.330.0090.00916.68
7.2.320.0130.01016.66
7.2.310.0000.01716.43
7.2.300.0130.00616.70
7.2.290.0090.00916.31
7.2.60.0080.00416.81
7.2.50.0050.00516.90
7.2.00.0090.00619.11
7.1.200.0270.00015.41
7.1.100.3890.01316.28
7.1.90.2950.01315.97
7.1.80.2030.00716.30
7.1.70.1410.00716.15
7.1.60.0850.00524.23
7.1.50.2080.01733.52
7.1.40.1620.01533.20
7.1.30.1680.01933.37
7.1.20.1020.01333.53
7.1.10.1140.01515.57
7.1.00.1340.00815.52
7.0.240.2560.01015.91
7.0.230.3510.00316.10
7.0.220.2790.01015.88
7.0.210.0680.00714.91
7.0.200.0450.01515.68
7.0.190.1460.00615.79
7.0.180.0080.01315.35
7.0.170.0050.01615.32
7.0.160.0400.01014.37
7.0.150.0630.01115.28
7.0.140.1280.01514.41
7.0.130.0090.01415.46
7.0.120.0650.01215.63
7.0.110.1210.01014.48
7.0.100.0920.01515.38
7.0.90.1560.01314.42
7.0.80.1460.01214.42
7.0.70.0310.01015.31
7.0.60.1520.01815.03
7.0.50.0900.00515.33
7.0.40.1270.01215.44
7.0.30.0290.01314.49
7.0.20.0650.01115.39
7.0.10.0280.00914.51
7.0.00.0080.00815.36

preferences:
60.59 ms | 401 KiB | 5 Q