3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait ClosureInATrait { public static function getConstInTrait() { return __CLASS__; } } class ClassConstantTest { use ClosureInATrait; public static function getConstInClass() { return __CLASS__; } } $closureInClass = (new ReflectionMethod('ClassConstantTest','getConstInClass'))->getClosure(); $closureInTrait = (new ReflectionMethod('ClassConstantTest','getConstInTrait'))->getClosure(); echo 'Closure before bind: ' . PHP_EOL; echo 'Class closure: ' . PHP_EOL; var_dump($closureInClass()); echo 'Trait closure: ' . PHP_EOL; var_dump($closureInTrait()); $closureInClass = Closure::bind($closureInClass, null, 'stdClass'); $closureInTrait = Closure::bind($closureInTrait, null, 'stdClass'); echo 'Closure after bind: ' . PHP_EOL; echo 'Class closure: ' . PHP_EOL; var_dump($closureInClass()); echo 'Trait closure: ' . 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.0120.00316.74
8.3.50.0090.00922.12
8.3.40.0110.00718.85
8.3.30.0070.01019.04
8.3.20.0040.00420.33
8.3.10.0000.00723.69
8.3.00.0080.00020.95
8.2.180.0070.00716.63
8.2.170.0070.00722.96
8.2.160.0100.00320.53
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0000.00820.91
8.2.110.0100.00021.96
8.2.100.0030.00720.52
8.2.90.0040.00419.05
8.2.80.0000.00817.97
8.2.70.0000.00817.38
8.2.60.0000.00718.04
8.2.50.0040.00418.07
8.2.40.0040.00419.76
8.2.30.0080.00018.36
8.2.20.0060.00317.82
8.2.10.0030.00618.06
8.2.00.0090.00017.77
8.1.280.0070.00725.92
8.1.270.0000.00823.96
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00722.04
8.1.230.0080.00319.22
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0040.00417.38
8.1.190.0030.00617.23
8.1.180.0000.00818.10
8.1.170.0040.00418.53
8.1.160.0040.00422.10
8.1.150.0040.00418.67
8.1.140.0040.00417.38
8.1.130.0030.00517.86
8.1.120.0030.00617.51
8.1.110.0050.00317.46
8.1.100.0000.00817.54
8.1.90.0040.00417.45
8.1.80.0040.00417.49
8.1.70.0030.00317.36
8.1.60.0130.00017.59
8.1.50.0070.00017.52
8.1.40.0030.00617.43
8.1.30.0090.00017.64
8.1.20.0040.00417.62
8.1.10.0080.00017.64
8.1.00.0050.00317.63
8.0.300.0040.00418.77
8.0.290.0080.00016.88
8.0.280.0030.00318.47
8.0.270.0000.00717.20
8.0.260.0070.00017.19
8.0.250.0040.00417.02
8.0.240.0070.00016.93
8.0.230.0000.00716.87
8.0.220.0070.00016.98
8.0.210.0070.00016.98
8.0.200.0030.00317.04
8.0.190.0070.00017.04
8.0.180.0070.00016.97
8.0.170.0050.00216.90
8.0.160.0080.00017.03
8.0.150.0000.00816.98
8.0.140.0000.00716.97
8.0.130.0030.00313.46
8.0.120.0030.00616.96
8.0.110.0000.00716.98
8.0.100.0040.00416.94
8.0.90.0040.00416.92
8.0.80.0070.01416.95
8.0.70.0000.00717.04
8.0.60.0050.00216.87
8.0.50.0000.00817.00
8.0.30.0160.00317.08
8.0.20.0130.00817.40
8.0.10.0040.00416.94
8.0.00.0150.00616.89
7.4.330.0060.00015.00
7.4.320.0060.00016.57
7.4.300.0000.00616.60
7.4.290.0070.00016.52
7.4.280.0070.00016.62
7.4.270.0030.00316.60
7.4.260.0030.00316.54
7.4.250.0060.00316.39
7.4.240.0040.00416.54
7.4.230.0000.00716.45
7.4.220.0140.00516.66
7.4.210.0090.00516.68
7.4.200.0090.00016.43
7.4.190.0040.00416.42
7.4.160.0030.01316.59
7.4.150.0040.01317.40
7.4.140.0130.00417.86
7.4.130.0100.00716.62
7.4.120.0030.01916.54
7.4.110.0100.01016.65
7.4.100.0090.00816.60
7.4.90.0040.01216.75
7.4.80.0110.01119.39
7.4.70.0100.00616.52
7.4.60.0120.00416.53
7.4.50.0050.00516.57
7.4.40.0070.01016.41
7.4.30.0090.00616.65
7.4.00.0080.00815.16
7.3.330.0060.00013.27
7.3.320.0000.00513.39
7.3.310.0040.00416.37
7.3.300.0000.00716.20
7.3.290.0040.01116.28
7.3.280.0060.01216.31
7.3.270.0040.01417.40
7.3.260.0110.00616.32
7.3.250.0060.01116.45
7.3.240.0030.01316.49
7.3.230.0100.01316.39
7.3.210.0120.00616.62
7.3.200.0070.01419.39
7.3.190.0110.00716.49
7.3.180.0100.00716.46
7.3.170.0070.01116.55
7.3.160.0170.00616.36
7.3.120.0030.01314.75
7.3.110.0110.00314.89
7.3.100.0040.01214.66
7.3.90.0100.00714.85
7.3.80.0030.00715.00
7.3.70.0030.00714.87
7.3.60.0070.00414.51
7.3.50.0060.01014.58
7.3.40.0030.01014.89
7.3.30.0000.01414.79
7.3.20.0000.00916.58
7.3.10.0040.01516.33
7.3.00.0080.00316.58
7.2.330.0060.01216.49
7.2.320.0060.01316.67
7.2.310.0100.00716.69
7.2.300.0070.01116.66
7.2.290.0130.01016.65
7.2.240.0070.01014.84
7.2.230.0060.00615.14
7.2.220.0060.00615.18
7.2.210.0090.00615.06
7.2.200.0040.01414.72
7.2.190.0030.01314.81
7.2.180.0030.01314.95
7.2.170.0060.01015.12
7.2.160.0040.01114.80
7.2.150.0110.00717.01
7.2.140.0040.01216.95
7.2.130.0070.01117.05
7.2.120.0070.00716.88
7.2.110.0120.00317.03
7.2.100.0040.00716.73
7.2.90.0100.00716.98
7.2.80.0110.00716.99
7.2.70.0110.00716.95
7.2.60.0090.00617.00
7.2.50.0090.00616.95
7.2.40.0060.00917.00
7.2.30.0060.00617.00
7.2.20.0070.01116.86
7.2.10.0110.00416.79
7.2.00.0090.00817.98
7.1.330.0030.01015.57
7.1.320.0040.01115.79
7.1.310.0090.00315.82
7.1.300.0060.00815.68
7.1.290.0030.00615.59
7.1.280.0070.00715.76
7.1.270.0100.00715.59
7.1.260.0140.00015.79
7.1.250.0090.00615.93
7.1.200.0070.00315.75
7.1.100.0030.00918.07
7.1.70.0000.01016.99
7.1.60.0070.01719.70
7.1.50.0100.01416.90
7.1.00.0070.07322.28
7.0.200.0000.00716.44
7.0.140.0070.06722.01
7.0.110.0600.08720.08
7.0.100.0600.08020.00
7.0.90.0630.08319.98
7.0.80.0670.08019.96
7.0.70.0670.07719.98
7.0.60.0570.04720.02
7.0.50.0530.08019.88
7.0.40.0100.08019.66
7.0.30.0070.08019.83
7.0.20.0100.08019.71
7.0.10.0100.08019.74
7.0.00.0130.08019.64
5.6.280.0130.06321.07
5.6.260.0170.07020.65
5.6.250.0030.08320.59
5.6.240.0000.06320.70
5.6.230.0030.08320.86
5.6.220.0130.08020.56
5.6.210.0070.09720.62
5.6.200.0030.05020.60
5.6.190.0000.04320.82
5.6.180.0100.07720.83
5.6.170.0100.08020.85
5.6.160.0100.08020.59
5.6.150.0130.08020.71
5.6.140.0100.08320.56
5.6.130.0070.08020.70
5.6.120.0070.07720.55
5.6.110.0070.08320.70
5.6.100.0130.04320.45
5.6.90.0270.06720.54
5.6.80.0070.08020.08
5.6.70.0130.07720.23
5.6.60.0070.07720.18
5.6.50.0070.07320.00
5.6.40.0070.07320.06
5.6.30.0130.07019.82
5.6.20.0030.07720.00
5.6.10.0030.06719.91
5.6.00.0100.03719.84
5.5.380.0070.04717.68
5.5.370.0130.07317.51
5.5.360.0130.07317.46
5.5.350.0070.07317.66
5.5.340.0100.03018.22
5.5.330.0100.07318.08
5.5.320.0070.07718.11
5.5.310.0100.06718.25
5.5.300.0170.06717.93
5.5.290.0100.08318.09
5.5.280.0030.08317.90
5.5.270.0130.07718.21
5.5.260.0100.07718.25
5.5.250.0100.07718.03
5.5.240.0130.07317.65
5.5.230.0130.07317.63
5.5.220.0070.07717.21
5.5.210.0100.07017.60
5.5.200.0100.07317.60
5.5.190.0030.06017.57
5.5.180.0100.05717.41
5.5.160.0070.07017.45
5.5.150.0070.06717.44
5.5.140.0070.07317.61
5.5.130.0100.07317.59
5.5.120.0130.07717.39
5.5.110.0130.07717.40
5.5.100.0000.08317.17
5.5.90.0070.08017.08
5.5.80.0070.07317.30
5.5.70.0100.07317.50
5.5.60.0130.07317.17
5.5.50.0100.07717.17
5.5.40.0100.07317.34
5.5.30.0100.07017.28
5.5.20.0170.06317.15
5.5.10.0070.04017.46
5.5.00.0030.04017.30
5.4.450.0070.07719.28
5.4.440.0070.08019.32
5.4.430.0000.08319.56
5.4.420.0070.04319.41
5.4.410.0070.07719.34
5.4.400.0070.07319.23
5.4.390.0100.07319.34
5.4.380.0170.06719.03
5.4.370.0030.07719.02
5.4.360.0130.07318.99
5.4.350.0130.06718.99
5.4.340.0100.06719.03
5.4.320.0000.06019.23
5.4.310.0130.03319.31
5.4.300.0030.07719.24
5.4.290.0070.07719.18
5.4.280.0030.08318.96
5.4.270.0030.08318.99
5.4.260.0170.07319.08
5.4.250.0100.07019.02
5.4.240.0070.08018.98
5.4.230.0170.06319.08
5.4.220.0030.07719.23
5.4.210.0200.06319.31
5.4.200.0100.07318.97
5.4.190.0000.04719.15
5.4.180.0070.07019.13
5.4.170.0000.04718.98
5.4.160.0030.07719.06
5.4.150.0030.05019.16
5.4.140.0070.02716.54
5.4.130.0100.07016.55
5.4.120.0130.06716.34
5.4.110.0130.04316.26
5.4.100.0170.06016.55
5.4.90.0070.07016.48
5.4.80.0070.07016.61
5.4.70.0070.08316.35
5.4.60.0070.07016.55
5.4.50.0000.08016.63
5.4.40.0070.03716.68
5.4.30.0100.06716.47
5.4.20.0130.06716.48
5.4.10.0170.06316.28
5.4.00.0100.06716.05
5.3.290.0030.04314.52
5.3.280.0070.06314.61
5.3.270.0100.07314.62
5.3.260.0030.04014.40
5.3.250.0070.07014.48
5.3.240.0030.04314.68
5.3.230.0100.07314.45
5.3.220.0130.07014.47
5.3.210.0170.07314.50
5.3.200.0070.06014.46
5.3.190.0100.06714.56
5.3.180.0170.06014.51
5.3.170.0070.07714.47
5.3.160.0070.03714.60
5.3.150.0000.05714.56
5.3.140.0130.04014.48
5.3.130.0030.07714.63
5.3.120.0100.07714.41
5.3.110.0070.07014.34
5.3.100.0000.04313.97
5.3.90.0100.06714.13
5.3.80.0070.07714.09
5.3.70.0030.07713.93
5.3.60.0030.04013.84
5.3.50.0100.07013.73
5.3.40.0170.06313.88
5.3.30.0100.07013.98
5.3.20.0070.06313.77
5.3.10.0130.06313.60
5.3.00.0030.04013.54
5.2.170.0070.06010.93
5.2.160.0030.06011.16
5.2.150.0100.04011.05
5.2.140.0070.03711.08
5.2.130.0030.06711.03
5.2.120.0130.05311.16
5.2.110.0030.05011.01
5.2.100.0070.04311.11
5.2.90.0030.05311.00
5.2.80.0000.07010.88
5.2.70.0000.03711.09
5.2.60.0030.05010.99
5.2.50.0030.03011.09
5.2.40.0000.03010.98
5.2.30.0100.02310.99
5.2.20.0000.04011.02
5.2.10.0000.03010.78
5.2.00.0100.02310.79
5.1.60.0030.02710.14
5.1.50.0070.03710.06
5.1.40.0000.0279.95
5.1.30.0030.03310.22
5.1.20.0130.04310.49
5.1.10.0100.05010.08
5.1.00.0100.0479.99
5.0.50.0030.0339.86
5.0.40.0000.0239.86
5.0.30.0030.0339.86
5.0.20.0000.0239.86
5.0.10.0070.0309.86
5.0.00.0030.0309.86
4.4.90.0000.0179.86
4.4.80.0000.0279.86
4.4.70.0000.0179.86
4.4.60.0070.0209.86
4.4.50.0000.0179.86
4.4.40.0000.0309.86
4.4.30.0070.0179.86
4.4.20.0000.0379.86
4.4.10.0100.0209.86
4.4.00.0070.0479.86
4.3.110.0070.0339.86
4.3.100.0000.0179.86
4.3.90.0030.0209.86
4.3.80.0000.0309.86
4.3.70.0030.0239.86
4.3.60.0030.0139.86
4.3.50.0000.0179.86
4.3.40.0000.0409.86
4.3.30.0000.0179.86
4.3.20.0000.0309.86
4.3.10.0000.0239.86
4.3.00.0000.0179.86

preferences:
39.15 ms | 401 KiB | 5 Q