3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait ClosureInATrait { public static function getConstInTrait() { return __LINE__; } } 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.0170.00316.75
8.3.50.0140.00721.88
8.3.40.0040.01118.76
8.3.30.0030.01419.08
8.3.20.0050.00320.34
8.3.10.0040.00423.52
8.3.00.0040.00419.26
8.2.180.0130.01016.50
8.2.170.0060.01222.96
8.2.160.0070.00720.43
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00020.77
8.2.110.0100.00022.25
8.2.100.0100.00317.78
8.2.90.0000.01017.75
8.2.80.0040.00417.97
8.2.70.0000.00818.04
8.2.60.0050.00318.04
8.2.50.0030.00618.10
8.2.40.0000.00822.18
8.2.30.0000.00818.31
8.2.20.0000.00817.78
8.2.10.0030.00618.14
8.2.00.0050.00317.81
8.1.280.0070.00725.92
8.1.270.0090.00923.88
8.1.260.0000.00826.35
8.1.250.0050.00328.09
8.1.240.0030.00622.01
8.1.230.0040.00718.97
8.1.220.0050.00517.74
8.1.210.0030.00518.77
8.1.200.0000.00817.35
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0030.00618.71
8.1.160.0040.00421.95
8.1.150.0000.00718.56
8.1.140.0000.00717.47
8.1.130.0030.00317.91
8.1.120.0090.00017.38
8.1.110.0040.00417.46
8.1.100.0000.00817.49
8.1.90.0070.00017.50
8.1.80.0000.00717.39
8.1.70.0070.00017.42
8.1.60.0030.00617.66
8.1.50.0060.00317.55
8.1.40.0090.00017.52
8.1.30.0050.00317.58
8.1.20.0040.00417.58
8.1.10.0000.00817.50
8.1.00.0040.00417.57
8.0.300.0050.00319.58
8.0.290.0030.00516.75
8.0.280.0050.00218.50
8.0.270.0030.00317.16
8.0.260.0040.00417.38
8.0.250.0030.00317.10
8.0.240.0030.00316.93
8.0.230.0000.00717.07
8.0.220.0000.00716.87
8.0.210.0090.00016.96
8.0.200.0000.00717.06
8.0.190.0030.00517.00
8.0.180.0040.00416.95
8.0.170.0000.00716.88
8.0.160.0070.00016.96
8.0.150.0000.00816.90
8.0.140.0040.00416.90
8.0.130.0030.00313.44
8.0.120.0030.00516.84
8.0.110.0000.00716.86
8.0.100.0000.00716.75
8.0.90.0000.00717.02
8.0.80.0040.01216.93
8.0.70.0020.00516.85
8.0.60.0000.00716.99
8.0.50.0070.00016.98
8.0.30.0110.00917.29
8.0.20.0130.00717.40
8.0.10.0040.00417.07
8.0.00.0030.01516.78
7.4.330.0000.00515.00
7.4.320.0030.00616.39
7.4.300.0030.00316.57
7.4.290.0030.00316.46
7.4.280.0040.00416.61
7.4.270.0000.00716.61
7.4.260.0040.00416.59
7.4.250.0000.00916.57
7.4.240.0030.00516.60
7.4.230.0000.00716.64
7.4.220.0060.01616.57
7.4.210.0110.00316.48
7.4.200.0000.00716.62
7.4.190.0050.00216.66
7.4.160.0000.01616.49
7.4.150.0080.01117.40
7.4.140.0050.01217.86
7.4.130.0120.00816.60
7.4.120.0090.00816.63
7.4.110.0080.01316.56
7.4.100.0160.00616.46
7.4.90.0100.00716.75
7.4.80.0060.01219.39
7.4.70.0030.01316.60
7.4.60.0100.01316.45
7.4.50.0040.00416.46
7.4.40.0060.01016.34
7.4.30.0050.01116.59
7.4.00.0140.00315.13
7.3.330.0040.00213.18
7.3.320.0000.00613.08
7.3.310.0000.00716.18
7.3.300.0030.00316.34
7.3.290.0050.00916.25
7.3.280.0090.00716.28
7.3.270.0160.00817.40
7.3.260.0060.01216.59
7.3.250.0130.00516.50
7.3.240.0060.01216.41
7.3.230.0070.01016.55
7.3.210.0110.01116.42
7.3.200.0170.00319.39
7.3.190.0150.00616.30
7.3.180.0060.01016.43
7.3.170.0000.01616.38
7.3.160.0130.00616.27
7.3.120.0090.00614.86
7.3.00.0130.00316.54
7.2.330.0060.01216.66
7.2.320.0080.00916.80
7.2.310.0070.01016.38
7.2.300.0040.01416.55
7.2.290.0110.00816.80
7.2.130.0100.00716.93
7.2.120.0090.00616.68
7.2.110.0120.00716.80
7.2.100.0070.00416.97
7.2.90.0070.00716.84
7.2.80.0060.00916.67
7.2.70.0100.00316.59
7.2.60.0070.01016.87
7.2.50.0080.00416.94
7.2.40.0070.00716.90
7.2.30.0000.01417.04
7.2.20.0110.00716.65
7.2.10.0130.00316.84
7.2.00.0130.00716.93
7.1.250.0070.01115.66
7.1.240.0030.00615.50
7.1.230.0090.00615.50
7.1.220.0110.00615.79
7.1.210.0090.00615.79
7.1.200.0050.00515.61
7.1.190.0080.00515.75
7.1.180.0060.00615.66
7.1.170.0060.00915.64
7.1.160.0030.00815.76
7.1.150.0140.00415.48
7.1.140.0030.00615.69
7.1.130.0000.00915.71
7.1.120.0040.01115.83
7.1.110.0120.00015.89
7.1.100.0030.00916.92
7.1.90.0030.01015.88
7.1.80.0040.01115.82
7.1.70.0050.00916.42
7.1.60.0080.00817.59
7.1.50.0090.01016.39
7.1.40.0070.00415.75
7.1.30.0090.00615.59
7.1.20.0000.01215.73
7.1.10.0040.01215.76
7.1.00.0070.04018.92
7.0.330.0040.01215.19
7.0.320.0060.00615.15
7.0.310.0110.00415.38
7.0.300.0040.00715.41
7.0.290.0060.00915.24
7.0.280.0060.00915.32
7.0.270.0070.00715.24
7.0.260.0030.00915.07
7.0.250.0080.00415.27
7.0.240.0100.00315.38
7.0.230.0070.00715.23
7.0.220.0110.00315.63
7.0.210.0040.01115.53
7.0.200.0080.00215.05
7.0.190.0070.00315.33
7.0.180.0110.00315.46
7.0.170.0040.00715.36
7.0.160.0040.00715.43
7.0.150.0080.00615.48
7.0.140.0050.04118.73
7.0.130.0060.00615.45
7.0.120.0000.00815.63
7.0.110.0090.00615.43
7.0.100.0040.01115.28
7.0.90.0030.00715.21
7.0.80.0030.00715.40
7.0.70.0160.00315.42
7.0.60.0070.02217.74
7.0.50.0050.03116.64
7.0.40.0080.04516.77
7.0.30.0150.04316.83
7.0.20.0170.04016.84
7.0.10.0060.02616.72
7.0.00.0080.02716.75
5.6.380.0090.00014.06
5.6.370.0040.01314.38
5.6.360.0030.01714.16
5.6.350.0060.01214.56
5.6.340.0140.00514.34
5.6.330.0130.00814.00
5.6.320.0090.00914.12
5.6.310.0120.00914.27
5.6.300.0150.00013.99
5.6.290.0130.00314.29
5.6.280.0030.04217.79
5.6.270.0070.01014.48
5.6.260.0000.01014.33
5.6.250.0090.00614.38
5.6.240.0030.01014.40
5.6.230.0040.01114.30
5.6.220.0060.00614.21
5.6.210.0110.03617.55
5.6.200.0040.03916.19
5.6.190.0080.02317.36
5.6.180.0190.03117.41
5.6.170.0120.02517.38
5.6.160.0060.04817.44
5.6.150.0080.02116.39
5.6.140.0070.02516.20
5.6.130.0060.04316.32
5.6.120.0040.04117.82
5.6.110.0070.04517.55
5.6.100.0140.04017.61
5.6.90.0120.03817.77
5.6.80.0090.04217.22
5.6.70.0040.01113.93
5.6.60.0030.01014.15
5.6.50.0030.00714.26
5.6.40.0030.00714.14
5.6.30.0100.00714.19
5.6.20.0030.00614.07
5.6.10.0040.00714.29
5.6.00.0040.00814.11
5.5.380.0070.00311.18
5.5.370.0030.00311.18
5.5.360.0040.00411.18
5.5.350.0030.04615.87
5.5.340.0070.02114.60
5.5.330.0040.03215.82
5.5.320.0030.03815.74
5.5.310.0100.02815.76
5.5.300.0030.04614.63
5.5.290.0050.02914.70
5.5.280.0050.03516.04
5.5.270.0080.04016.01
5.5.260.0110.04015.99
5.5.250.0050.02315.91
5.5.240.2020.02415.68
5.5.230.0000.01011.23
5.5.220.0060.00311.18
5.5.210.0030.00911.18
5.5.200.0000.01011.18
5.5.190.0050.00311.18
5.5.180.0070.00311.18
5.5.170.0000.00911.18
5.5.160.0030.00311.18
5.5.150.0040.00411.18
5.5.140.0000.00711.22
5.5.130.0030.00611.21
5.5.120.0030.00611.24
5.5.110.0000.00811.22
5.5.100.0000.00911.18
5.5.90.0000.00811.18
5.5.80.0000.00811.18
5.5.70.0060.00311.18
5.5.60.0030.00511.18
5.5.50.0040.00411.18
5.5.40.0060.00311.18
5.5.30.0070.00411.18
5.5.20.0040.00811.18
5.5.10.0050.00011.18
5.5.00.0050.00711.18
5.4.450.0150.02915.32
5.4.440.0220.02315.33
5.4.430.0080.02715.35
5.4.420.0320.02515.33
5.4.410.0160.02315.27
5.4.400.0100.02615.01
5.4.390.0080.02615.21
5.4.380.0120.02914.83
5.4.370.0100.03014.98
5.4.360.0110.02814.95
5.4.350.0080.03014.95
5.4.340.0120.03014.97
5.4.330.0110.00011.18
5.4.320.0050.02011.84
5.4.310.0050.02311.84
5.4.300.0070.02311.84
5.4.290.0070.02311.84
5.4.280.0050.02211.79
5.4.270.0020.03211.79
5.4.260.0070.02111.78
5.4.250.0060.02411.78
5.4.240.0020.03511.79
5.4.230.0060.02711.78
5.4.220.0020.02611.78
5.4.210.0040.03711.78
5.4.200.0090.02911.78
5.4.190.0040.03611.78
5.4.180.0080.03011.78
5.4.170.0030.03311.78
5.4.160.0100.02411.78
5.4.150.0050.02911.78
5.4.140.0070.02211.63
5.4.130.0070.01811.62
5.4.120.0050.02211.60
5.4.110.0040.02311.59
5.4.100.0070.02111.59
5.4.90.0070.01811.59
5.4.80.0070.01811.59
5.4.70.0030.02311.59
5.4.60.0060.02111.59
5.4.50.0050.02111.59
5.4.40.0040.02111.58
5.4.30.0080.02111.58
5.4.20.0040.02411.58
5.4.10.0060.02111.59
5.4.00.0080.02011.33
5.3.290.0050.02311.99
5.3.280.0060.02011.94
5.3.270.0080.02111.95
5.3.260.0090.02311.95
5.3.250.0050.02311.95
5.3.240.0040.02211.95
5.3.230.0040.02311.94
5.3.220.0040.02111.93
5.3.210.0050.02511.93
5.3.200.0070.02011.93
5.3.190.0050.02511.93
5.3.180.0020.02511.92
5.3.170.0040.02211.92
5.3.160.0060.01811.93
5.3.150.0060.02011.92
5.3.140.0080.01911.92
5.3.130.0040.02211.92
5.3.120.0050.02311.92
5.3.110.0040.02311.92
5.3.100.0070.01911.65
5.3.90.0050.02211.63
5.3.80.0030.02111.63
5.3.70.0060.02311.62
5.3.60.0040.02211.62
5.3.50.0070.02411.59
5.3.40.0080.01911.59
5.3.30.0020.02411.56
5.3.20.0040.02311.45
5.3.10.0040.02411.44
5.3.00.0070.01911.43
5.2.170.0060.01810.18
5.2.160.0060.01810.18
5.2.150.0020.02110.18
5.2.140.0040.02010.18
5.2.130.0060.01610.16
5.2.120.0030.01910.16
5.2.110.0050.01710.16
5.2.100.0020.01810.16
5.2.90.0040.02610.16
5.2.80.0060.02210.16
5.2.70.0060.01810.16
5.2.60.0060.01710.13
5.2.50.0030.01810.12
5.2.40.0060.01410.10
5.2.30.0030.01710.10
5.2.20.0010.02010.09
5.2.10.0070.01410.05
5.2.00.0050.0169.98
5.1.60.0050.0139.62
5.1.50.0070.0109.62
5.1.40.0040.0169.61
5.1.30.0060.0149.79
5.1.20.0050.0159.80
5.1.10.0020.0149.66
5.1.00.0010.0199.66
5.0.50.0020.0158.90
5.0.40.0020.0128.83
5.0.30.0030.0178.73
5.0.20.0060.0118.72
5.0.10.0040.0138.71
5.0.00.0040.0208.71
4.4.90.0020.0107.98
4.4.80.0040.0107.96
4.4.70.0020.0097.96
4.4.60.0010.0107.96
4.4.50.0030.0097.97
4.4.40.0050.0127.94
4.4.30.0020.0097.97
4.4.20.0000.0108.01
4.4.10.0040.0078.01
4.4.00.0060.0117.97
4.3.110.0030.0107.92
4.3.100.0020.0097.92
4.3.90.0020.0107.91
4.3.80.0030.0157.88
4.3.70.0020.0107.90
4.3.60.0020.0107.90
4.3.50.0030.0107.90
4.3.40.0030.0147.86
4.3.30.0030.0117.23
4.3.20.0020.0107.22
4.3.10.0020.0107.20
4.3.00.0020.01231.33

preferences:
42.96 ms | 400 KiB | 5 Q