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 '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.0110.00416.63
8.3.50.0110.00622.04
8.3.40.0110.00418.92
8.3.30.0030.01219.22
8.3.20.0050.00320.21
8.3.10.0080.00023.53
8.3.00.0080.00020.95
8.2.180.0070.01416.63
8.2.170.0090.01222.96
8.2.160.0080.00620.26
8.2.150.0000.00724.18
8.2.140.0000.00824.66
8.2.130.0030.00326.16
8.2.120.0050.00320.82
8.2.110.0000.00922.10
8.2.100.0000.01120.40
8.2.90.0000.00919.05
8.2.80.0090.00017.97
8.2.70.0050.00317.50
8.2.60.0060.00317.93
8.2.50.0030.00618.07
8.2.40.0030.00519.82
8.2.30.0070.00018.09
8.2.20.0000.00817.68
8.2.10.0020.00517.99
8.2.00.0000.00817.70
8.1.280.0100.00725.92
8.1.270.0040.00423.91
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0080.00022.09
8.1.230.0080.00419.00
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0030.00617.48
8.1.190.0060.00317.23
8.1.180.0050.00318.10
8.1.170.0030.00518.56
8.1.160.0000.00721.95
8.1.150.0030.00618.62
8.1.140.0050.00217.52
8.1.130.0000.00817.84
8.1.120.0060.00317.39
8.1.110.0040.00417.45
8.1.100.0040.00417.41
8.1.90.0000.00817.52
8.1.80.0000.00717.46
8.1.70.0000.00717.44
8.1.60.0060.00317.59
8.1.50.0000.00817.52
8.1.40.0000.00817.46
8.1.30.0040.00417.60
8.1.20.0000.00817.65
8.1.10.0000.00917.61
8.1.00.0080.00017.51
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0000.00718.46
8.0.270.0070.00017.18
8.0.260.0070.00017.26
8.0.250.0000.00717.02
8.0.240.0000.00716.93
8.0.230.0040.00417.00
8.0.220.0030.00316.86
8.0.210.0040.00417.00
8.0.200.0030.00317.07
8.0.190.0070.00016.94
8.0.180.0080.00016.99
8.0.170.0080.00016.93
8.0.160.0030.00416.97
8.0.150.0040.00417.00
8.0.140.0070.00016.94
8.0.130.0060.00013.37
8.0.120.0040.00416.90
8.0.110.0040.00417.02
8.0.100.0040.00417.00
8.0.90.0040.00416.93
8.0.80.0120.00917.00
8.0.70.0040.00416.77
8.0.60.0070.00016.79
8.0.50.0000.00716.96
8.0.30.0130.00717.20
8.0.20.0090.00917.40
8.0.10.0000.00816.94
8.0.00.0130.00816.97
7.4.330.0050.00015.00
7.4.320.0040.00416.53
7.4.300.0060.00016.44
7.4.290.0030.00316.41
7.4.280.0000.00716.51
7.4.270.0030.00316.56
7.4.260.0050.00316.61
7.4.250.0050.00316.61
7.4.240.0050.00216.46
7.4.230.0000.00816.64
7.4.220.0080.01116.52
7.4.210.0000.01616.68
7.4.200.0000.00716.52
7.4.190.0080.00016.56
7.4.160.0080.00816.55
7.4.150.0080.00817.40
7.4.140.0120.00517.86
7.4.130.0080.00916.45
7.4.120.0100.00916.41
7.4.110.0170.00316.39
7.4.100.0040.01316.63
7.4.90.0100.00716.75
7.4.80.0170.00319.39
7.4.70.0130.00316.45
7.4.60.0060.01416.48
7.4.50.0000.00716.44
7.4.40.0090.00916.58
7.4.30.0090.00616.49
7.4.00.0080.00815.12
7.3.330.0000.00613.18
7.3.320.0060.00013.18
7.3.310.0030.00316.36
7.3.300.0020.00516.36
7.3.290.0110.00416.29
7.3.280.0080.00816.33
7.3.270.0040.01217.40
7.3.260.0130.00516.58
7.3.250.0110.01016.36
7.3.240.0030.01516.29
7.3.230.0070.01016.39
7.3.210.0030.01416.51
7.3.200.0140.00719.39
7.3.190.0060.01116.54
7.3.180.0130.01016.62
7.3.170.0130.00816.27
7.3.160.0060.00916.38
7.3.120.0100.00814.79
7.3.110.0030.01614.86
7.3.100.0070.01114.93
7.3.90.0030.01214.84
7.3.80.0040.01115.00
7.3.70.0090.00914.74
7.3.60.0080.00614.70
7.3.50.0030.00614.77
7.3.40.0070.00714.82
7.3.30.0070.01014.88
7.3.20.0030.01616.71
7.3.10.0030.01416.62
7.3.00.0060.00916.63
7.2.330.0100.01316.73
7.2.320.0040.01716.39
7.2.310.0070.01016.33
7.2.300.0060.01216.29
7.2.290.0130.01016.38
7.2.250.0070.00714.73
7.2.240.0130.00615.22
7.2.230.0100.00315.20
7.2.220.0040.01114.70
7.2.210.0100.00614.78
7.2.200.0040.00415.18
7.2.190.0100.00614.88
7.2.180.0000.01314.81
7.2.170.0120.00015.19
7.2.130.0070.00716.86
7.2.120.0030.01216.85
7.2.110.0000.01416.91
7.2.100.0030.00916.89
7.2.90.0090.00317.00
7.2.80.0130.00316.86
7.2.70.0100.00716.59
7.2.60.0060.01116.77
7.2.50.0040.01216.79
7.2.40.0140.00316.84
7.2.30.0030.01016.64
7.2.20.0090.00616.58
7.2.10.0000.01516.88
7.2.00.0080.00518.06
7.1.330.0060.00915.94
7.1.320.0090.00315.77
7.1.310.0120.00315.53
7.1.300.0070.01015.58
7.1.290.0070.01015.68
7.1.280.0040.01115.77
7.1.270.0040.01415.76
7.1.260.0060.01215.82
7.1.250.0170.00015.83
7.1.240.0060.00315.50
7.1.230.0040.00715.80
7.1.220.0030.00915.77
7.1.210.0040.00415.80
7.1.200.0060.00515.73
7.1.190.0110.00415.75
7.1.180.0100.01015.43
7.1.170.0040.01115.83
7.1.160.0110.00415.79
7.1.150.0030.01215.69
7.1.140.0000.01015.57
7.1.130.0040.00715.63
7.1.120.0070.00715.45
7.1.110.0090.00915.71
7.1.100.0060.00716.92
7.1.90.0040.01115.32
7.1.80.0100.00315.48
7.1.70.0080.00516.35
7.1.60.0060.01117.59
7.1.50.0070.00516.32
7.1.40.0120.00315.88
7.1.30.0050.00315.77
7.1.20.0160.00015.66
7.1.10.0030.00615.23
7.1.00.0070.04019.11
7.0.330.0060.00615.26
7.0.320.0000.00915.25
7.0.310.0060.00615.31
7.0.300.0080.01215.36
7.0.290.0000.01015.52
7.0.280.0100.00315.27
7.0.270.0050.00515.05
7.0.260.0110.00315.30
7.0.250.0060.00915.43
7.0.240.0000.01015.50
7.0.230.0090.00615.29
7.0.220.0040.01115.17
7.0.210.0110.00715.38
7.0.200.0030.00715.93
7.0.190.0040.01115.30
7.0.180.0100.00715.45
7.0.170.0030.00915.58
7.0.160.0070.00715.19
7.0.150.0030.00715.03
7.0.140.0040.03618.64
7.0.130.0000.01015.09
7.0.120.0070.00715.24
7.0.110.0020.00515.25
7.0.100.0030.00715.28
7.0.90.0090.00615.24
7.0.80.0120.00015.30
7.0.70.0110.00015.24
7.0.60.0070.04917.74
7.0.50.0030.03216.71
7.0.40.0090.04616.69
7.0.30.0160.04016.83
7.0.20.0200.03816.77
7.0.10.0150.04416.79
7.0.00.0060.04116.76
5.6.380.0000.01514.09
5.6.370.0090.00314.37
5.6.360.0030.01014.27
5.6.350.0090.00614.32
5.6.340.0030.00913.85
5.6.330.0080.00313.93
5.6.320.0030.01014.35
5.6.310.0160.00014.59
5.6.300.0030.00914.52
5.6.290.0030.00614.21
5.6.280.0020.04217.56
5.6.270.0000.00914.20
5.6.260.0040.00814.23
5.6.250.0030.01014.21
5.6.240.0050.00513.88
5.6.230.0030.01214.46
5.6.220.0080.00414.30
5.6.210.0080.04117.42
5.6.200.0030.04516.19
5.6.190.0100.04517.32
5.6.180.0090.04117.37
5.6.170.0240.04217.31
5.6.160.0070.04317.41
5.6.150.0100.04016.13
5.6.140.0070.04416.16
5.6.130.0050.03016.42
5.6.120.0080.04417.53
5.6.110.0060.04817.69
5.6.100.0170.02517.53
5.6.90.0100.04317.83
5.6.80.0090.03517.25
5.6.70.2280.02317.27
5.6.60.0060.00814.07
5.6.50.0090.00314.32
5.6.40.0050.00814.21
5.6.30.0040.00814.12
5.6.20.0060.00613.97
5.6.10.0000.01314.07
5.6.00.0080.00814.16
5.5.380.0030.00611.18
5.5.370.0030.00711.18
5.5.360.0030.00311.18
5.5.350.0050.04315.79
5.5.340.0050.02514.58
5.5.330.0080.04515.77
5.5.320.0160.02315.78
5.5.310.0220.02715.74
5.5.300.0070.02214.61
5.5.290.0120.01714.57
5.5.280.0090.04315.91
5.5.270.0070.02616.02
5.5.260.0060.04615.97
5.5.250.0140.03515.93
5.5.240.0030.04215.71
5.5.230.0080.00011.18
5.5.220.0060.00311.18
5.5.210.0060.00311.18
5.5.200.0030.00311.18
5.5.190.0000.01111.18
5.5.180.0000.00611.18
5.5.170.0030.00711.18
5.5.160.0070.00711.18
5.5.150.0000.00711.18
5.5.140.0040.00811.18
5.5.130.0070.00311.18
5.5.120.0070.00411.18
5.5.110.0080.00311.18
5.5.100.0030.00311.18
5.5.90.0000.00611.18
5.5.80.0080.00011.18
5.5.70.0060.00611.18
5.5.60.0070.00311.18
5.5.50.0030.00611.18
5.5.40.0040.00411.18
5.5.30.0030.00911.18
5.5.20.0030.00611.18
5.5.10.0050.00311.18
5.5.00.0040.00911.18
5.4.450.0100.02415.33
5.4.440.0150.04015.17
5.4.430.0150.02515.28
5.4.420.0180.03715.28
5.4.410.0100.03315.22
5.4.400.0180.03515.06
5.4.390.0150.02615.15
5.4.380.0150.03115.13
5.4.370.0120.04115.06
5.4.360.0130.03415.15
5.4.350.0150.03715.13
5.4.340.0070.04415.01
5.4.330.0050.00511.18
5.4.320.0110.04115.10
5.4.310.0130.04015.21
5.4.300.0100.04215.06
5.4.290.0130.02315.11
5.4.280.0100.04015.01
5.4.270.0130.02715.20
5.4.260.0080.02915.13
5.4.250.0100.03015.15
5.4.240.0100.03815.07
5.4.230.0100.03615.19
5.4.220.0180.03515.08
5.4.210.0100.03815.21
5.4.200.0080.03415.21
5.4.190.0170.02215.19
5.4.180.0130.03615.08
5.4.170.0100.04315.07
5.4.160.0250.02815.16
5.4.150.0090.03115.03
5.4.140.0120.02213.75
5.4.130.0140.03113.83
5.4.120.0160.04013.88
5.4.110.0170.03313.88
5.4.100.0100.02013.89
5.4.90.0100.01913.84
5.4.80.0080.02113.90
5.4.70.0070.02413.74
5.4.60.0120.01913.76
5.4.50.0100.01813.84
5.4.40.0100.01813.71
5.4.30.0050.02313.80
5.4.20.0080.02013.85
5.4.10.0130.02013.84
5.4.00.0120.02713.47
5.3.290.0150.02612.90
5.3.280.0130.03312.82
5.3.270.0130.03812.83
5.3.260.0100.04312.88
5.3.250.0120.02612.84
5.3.240.0080.02312.81
5.3.230.0160.03312.81
5.3.220.0140.03712.82
5.3.210.0110.04012.89
5.3.200.0130.02712.83
5.3.190.0110.01712.81
5.3.180.0080.02212.90
5.3.170.0130.01712.85
5.3.160.0080.02112.80
5.3.150.0120.01712.84
5.3.140.0100.01812.79
5.3.130.0120.01512.78
5.3.120.0100.02112.78
5.3.110.0100.02112.86
5.3.100.0110.02012.53
5.3.90.0050.02412.57
5.3.80.0070.04012.48
5.3.70.0100.04012.57
5.3.60.0150.01512.50
5.3.50.0100.03712.53
5.3.40.0080.03312.54
5.3.30.0030.02412.60
5.3.20.0100.01812.40
5.3.10.0100.03112.31
5.3.00.0030.02212.39
5.2.170.0130.01311.67
5.2.160.0070.02011.67
5.2.150.0080.01511.67
5.2.140.0050.01811.67
5.2.130.0110.01511.67
5.2.120.0060.01511.67
5.2.110.0070.01711.67
5.2.100.0070.01811.67
5.2.90.0030.02011.67
5.2.80.0030.02011.67
5.2.70.0050.01811.67
5.2.60.0060.01611.67
5.2.50.0080.01611.67
5.2.40.0030.01811.67
5.2.30.0060.01911.67
5.2.20.0070.01811.67
5.2.10.0050.02411.67
5.2.00.0040.01511.67
5.1.60.0050.01311.67
5.1.50.0030.01711.67
5.1.40.0060.01311.67
5.1.30.0050.01911.67
5.1.20.0010.01811.67
5.1.10.0080.01211.67
5.1.00.0030.01411.67
5.0.50.0050.00911.67
5.0.40.0060.00811.67
5.0.30.0010.01811.67
5.0.20.0020.01511.67
5.0.10.0050.02211.67
5.0.00.0030.02511.67
4.4.90.0040.00711.67
4.4.80.0000.01011.67
4.4.70.0020.00911.67
4.4.60.0020.01211.67
4.4.50.0050.01611.67
4.4.40.0020.01611.67
4.4.30.0050.01011.67
4.4.20.0060.00811.67
4.4.10.0060.00811.67
4.4.00.0070.01211.67
4.3.110.0030.00911.67
4.3.100.0020.01011.67
4.3.90.0020.00811.67
4.3.80.0050.02611.67
4.3.70.0000.01311.67
4.3.60.0030.01711.67
4.3.50.0010.01811.67
4.3.40.0020.02511.67
4.3.30.0050.00811.67
4.3.20.0020.00811.67
4.3.10.0020.00811.67
4.3.00.0030.01311.67

preferences:
36.47 ms | 401 KiB | 5 Q