3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait ClosureInATrait { public static function getClosureInTrait() { return function () { return __CLASS__; }; } } class ClassConstantTest { use ClosureInATrait; public static function getClosureInClass() { return function () { return __CLASS__; }; } } $closureInClass = ClassConstantTest::getClosureInClass(); $closureInTrait = ClassConstantTest::getClosureInTrait(); echo 'Before bind: ' . PHP_EOL; echo '__CLASS__ in class: ' . PHP_EOL; var_dump($closureInClass()); echo '__CLASS__ in Trait: ' . PHP_EOL; var_dump($closureInTrait()); $closureInClass = Closure::bind($closureInClass, null, 'stdClass'); $closureInTrait = Closure::bind($closureInTrait, null, 'stdClass'); echo 'After bind: ' . PHP_EOL; echo '__CLASS__ in class: ' . PHP_EOL; var_dump($closureInClass()); echo '__CLASS__ in Trait: ' . PHP_EOL; var_dump($closureInTrait());

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.00716.75
8.3.50.0060.01021.88
8.3.40.0040.01118.80
8.3.30.0060.01319.09
8.3.20.0080.00020.19
8.3.10.0050.00323.65
8.3.00.0000.00820.94
8.2.180.0120.00316.88
8.2.170.0140.00022.96
8.2.160.0080.00520.44
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00420.69
8.2.110.0030.00622.25
8.2.100.0040.00720.52
8.2.90.0000.00819.13
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0040.00418.04
8.2.50.0040.00418.07
8.2.40.0000.00819.94
8.2.30.0030.00618.34
8.2.20.0000.00817.84
8.2.10.0050.00218.15
8.2.00.0080.00017.69
8.1.280.0070.00725.92
8.1.270.0050.00323.82
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0040.00422.01
8.1.230.0000.01119.08
8.1.220.0000.00717.74
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0030.00517.25
8.1.180.0030.00518.10
8.1.170.0050.00318.65
8.1.160.0000.00822.02
8.1.150.0000.00718.64
8.1.140.0050.00217.35
8.1.130.0000.00717.91
8.1.120.0030.00717.49
8.1.110.0040.00317.36
8.1.100.0000.00817.44
8.1.90.0080.00017.48
8.1.80.0040.00417.51
8.1.70.0030.00317.47
8.1.60.0130.00017.67
8.1.50.0030.00517.43
8.1.40.0000.00817.43
8.1.30.0050.00317.65
8.1.20.0030.00517.66
8.1.10.0000.00817.66
8.1.00.0050.00317.54
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0030.00318.37
8.0.270.0070.00017.18
8.0.260.0000.00617.15
8.0.250.0040.00417.04
8.0.240.0030.00516.87
8.0.230.0030.00417.03
8.0.220.0030.00316.91
8.0.210.0000.00717.03
8.0.200.0030.00317.07
8.0.190.0000.00817.00
8.0.180.0070.00016.88
8.0.170.0040.00416.92
8.0.160.0000.00717.03
8.0.150.0000.00716.88
8.0.140.0000.00816.94
8.0.130.0000.00613.40
8.0.120.0000.00816.91
8.0.110.0000.00717.03
8.0.100.0000.00816.99
8.0.90.0030.00516.91
8.0.80.0140.00716.98
8.0.70.0000.00716.77
8.0.60.0070.00016.80
8.0.50.0040.00416.93
8.0.30.0090.00917.19
8.0.20.0120.00817.40
8.0.10.0000.00716.96
8.0.00.0100.00816.78
7.4.330.0000.00415.00
7.4.320.0000.00616.58
7.4.300.0060.00016.44
7.4.290.0080.00016.53
7.4.280.0000.00816.62
7.4.270.0000.00716.52
7.4.260.0030.00516.53
7.4.250.0040.00416.59
7.4.240.0020.00516.46
7.4.230.0000.00716.40
7.4.220.0150.00316.60
7.4.210.0100.00316.66
7.4.200.0000.00716.70
7.4.190.0040.00416.66
7.4.160.0110.00516.52
7.4.150.0050.01317.40
7.4.140.0110.00717.86
7.4.130.0110.00616.59
7.4.120.0110.00616.50
7.4.110.0150.00416.71
7.4.100.0110.00616.59
7.4.90.0080.00816.35
7.4.80.0130.00319.39
7.4.70.0090.00916.61
7.4.60.0130.00616.69
7.4.50.0030.00316.63
7.4.40.0030.01316.76
7.4.30.0090.00616.47
7.4.00.0070.01014.82
7.3.330.0100.00013.34
7.3.320.0060.00013.25
7.3.310.0030.00316.41
7.3.300.0050.00216.24
7.3.290.0100.01016.36
7.3.280.0040.01416.40
7.3.270.0050.01117.40
7.3.260.0120.00316.46
7.3.250.0100.00716.43
7.3.240.0090.01316.57
7.3.230.0120.00616.41
7.3.210.0060.01216.43
7.3.200.0070.01619.39
7.3.190.0150.00316.63
7.3.180.0140.00716.52
7.3.170.0130.00916.59
7.3.160.0140.00316.55
7.3.120.0070.01414.53
7.3.110.0070.01114.88
7.3.100.0080.00315.08
7.3.90.0030.01014.81
7.3.80.0030.00714.59
7.3.70.0130.00014.70
7.3.60.0120.00315.00
7.3.50.0070.00714.84
7.3.40.0040.00814.71
7.3.30.0070.00314.83
7.3.20.0100.00616.50
7.3.10.0070.00716.70
7.3.00.0000.00916.74
7.2.330.0160.00616.86
7.2.320.0170.00716.55
7.2.310.0060.01016.73
7.2.300.0090.00916.56
7.2.290.0090.00916.53
7.2.240.0060.00915.39
7.2.230.0090.00615.02
7.2.220.0100.00615.27
7.2.210.0040.01115.29
7.2.200.0070.00415.09
7.2.190.0070.00414.99
7.2.180.0040.01114.76
7.2.170.0030.00915.16
7.2.160.0130.00315.09
7.2.150.0100.00716.96
7.2.140.0060.00916.89
7.2.130.0110.00416.75
7.2.120.0130.00317.02
7.2.110.0000.01416.67
7.2.100.0070.00316.93
7.2.90.0030.01617.04
7.2.80.0030.01317.16
7.2.70.0060.00917.01
7.2.60.0050.01116.86
7.2.50.0040.01116.81
7.2.40.0040.01416.89
7.2.30.0070.01116.69
7.2.20.0120.00617.09
7.2.10.0100.00616.79
7.2.00.0080.00718.07
7.1.330.0000.01815.59
7.1.320.0090.00315.78
7.1.310.0080.00015.61
7.1.300.0040.00415.94
7.1.290.0000.01115.58
7.1.280.0000.01015.93
7.1.270.0070.00715.55
7.1.260.0030.01015.59
7.1.250.0060.01015.61
7.1.200.0070.00415.53
7.1.100.0030.00818.28
7.1.70.0030.00617.20
7.1.60.0100.01019.70
7.1.50.0070.00716.93
7.1.00.0030.07722.32
7.0.200.0030.00516.72
7.0.140.0030.07322.18
7.0.60.0000.04320.11
7.0.50.0100.06317.90
7.0.40.0130.08720.13
7.0.30.0270.04320.07
7.0.20.0300.07320.19
7.0.10.0170.05320.16
7.0.00.0070.05720.30
5.6.280.0030.07320.79
5.6.210.0200.06720.77
5.6.200.0070.04318.24
5.6.190.0100.07020.42
5.6.180.0000.05320.67
5.6.170.0400.06720.48
5.6.160.0000.07320.59
5.6.150.0070.06318.18
5.6.140.0100.05718.18
5.6.130.0100.07718.27
5.6.120.0130.08321.06
5.6.110.0100.08321.15
5.6.100.0070.08021.05
5.6.90.0000.07720.97
5.6.80.0070.06020.40
5.6.70.4570.03020.54
5.5.350.0100.05720.43
5.5.340.0230.06017.95
5.5.330.0030.04720.38
5.5.320.0370.04320.34
5.5.310.0400.06720.26
5.5.300.0130.08017.98
5.5.290.0070.08018.04
5.5.280.0070.03720.75
5.5.270.0000.04320.73
5.5.260.0130.08320.88
5.5.250.0030.07720.70
5.5.240.0100.05720.20
5.4.450.0530.04319.21
5.4.440.1830.03719.63
5.4.430.1470.03719.46
5.4.420.1530.03719.31
5.4.410.1600.03319.36
5.4.400.0030.03719.09
5.4.390.0030.03719.06
5.4.380.0070.03719.13
5.4.370.0900.03719.19
5.4.360.2470.04019.13
5.4.350.1970.03318.94
5.4.340.0030.05018.84
5.4.320.0030.04719.13
5.4.310.0900.05019.19
5.4.300.2200.03719.23
5.4.290.1830.03318.86
5.4.280.1630.03719.26
5.4.270.1770.03319.09
5.4.260.1770.03319.05
5.4.250.1900.04018.83
5.4.240.2670.02319.23
5.4.230.1670.03019.14
5.4.220.1730.03719.30
5.4.210.1770.03319.21
5.4.200.1700.04019.33
5.4.190.1900.03719.05
5.4.180.2100.04319.21
5.4.170.1730.04019.13
5.4.160.2030.03719.20
5.4.150.2130.03718.96
5.4.140.1730.04016.44
5.4.130.2030.03716.50
5.4.120.1770.03716.33
5.4.110.2100.04316.26
5.4.100.2000.03716.64
5.4.90.2100.03716.52
5.4.80.2100.03716.61
5.4.70.2030.04716.31
5.4.60.2070.04016.34
5.4.50.2230.04016.16
5.4.40.1870.04316.47
5.4.30.2070.04016.52
5.4.20.2030.04016.33
5.4.10.2130.04716.52
5.4.00.2100.04315.95
5.3.290.2070.03314.52
5.3.280.1830.04014.45
5.3.270.2070.04014.55
5.3.260.2170.04714.47
5.3.250.2170.04314.65
5.3.240.2070.04714.57
5.3.230.1870.03314.44
5.3.220.2130.03714.55
5.3.210.2000.04714.52
5.3.200.1900.04014.46
5.3.190.2170.04714.52
5.3.180.2300.04314.42
5.3.170.0300.03314.50
5.3.160.0230.03314.61
5.3.150.0270.02714.44
5.3.140.0270.07014.66
5.3.130.0230.05014.57
5.3.120.0100.04314.46
5.3.110.0230.03314.40
5.3.100.0230.06713.95
5.3.90.0230.03014.04
5.3.80.0200.06313.96
5.3.70.0200.04013.92
5.3.60.0130.07013.95
5.3.50.0130.03313.93
5.3.40.0230.03013.96
5.3.30.0170.03713.77
5.3.20.0230.06313.53
5.3.10.0270.06713.56
5.3.00.0230.06713.62
5.2.170.0170.05311.05
5.2.160.0170.03711.08
5.2.150.0200.04011.05
5.2.140.0230.06010.99
5.2.130.0170.06310.94
5.2.120.0100.03710.96
5.2.110.0130.05711.01
5.2.100.0170.03011.15
5.2.90.0200.02711.01
5.2.80.0230.02010.93
5.2.70.0130.03011.13
5.2.60.0100.02711.05
5.2.50.0130.03311.17
5.2.40.0170.02310.90
5.2.30.0170.02711.13
5.2.20.0100.03010.82
5.2.10.0170.03010.81
5.2.00.0100.03710.60
5.1.60.0130.0279.89
5.1.50.0130.0379.98
5.1.40.0130.02310.06
5.1.30.0170.02310.19
5.1.20.0170.02710.35
5.1.10.0130.03010.15
5.1.00.0130.02310.19
5.0.50.0030.0238.44
5.0.40.0070.0208.53
5.0.30.0030.0338.38
5.0.20.0030.0208.18
5.0.10.0070.0208.05
5.0.00.0130.0238.08
4.4.90.0070.0337.63
4.4.80.0070.0137.63
4.4.70.0030.0177.63
4.4.60.0070.0137.63
4.4.50.0030.0177.63
4.4.40.0070.0337.63
4.4.30.0100.0137.63
4.4.20.0070.0137.63
4.4.10.0030.0177.63
4.4.00.0030.0277.63
4.3.110.0070.0137.63
4.3.100.0030.0177.63
4.3.90.0070.0177.63
4.3.80.0070.0277.63
4.3.70.0030.0177.63
4.3.60.0070.0137.63
4.3.50.0070.0277.63
4.3.40.0070.0307.63
4.3.30.0000.0177.63
4.3.20.0030.0137.63
4.3.10.0030.0177.63
4.3.00.0000.0177.63

preferences:
50 ms | 401 KiB | 5 Q