3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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(); var_dump('Closure before bind: ', $closureInClass(), $closureInTrait()); $closureInClass = Closure::bind($closureInClass, null, 'stdClass'); $closureInTrait = Closure::bind($closureInTrait, null, 'stdClass'); var_dump('Closure after bind: ', $closureInClass(), $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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0000.01616.39
7.3.00.0060.01016.47
7.2.130.0110.01116.85
7.2.120.0100.01016.80
7.2.110.0130.00516.51
7.2.100.0060.01616.85
7.2.90.0120.00816.77
7.2.80.0130.00316.54
7.2.70.0120.00616.87
7.2.60.0030.01116.71
7.2.50.0060.00616.76
7.2.40.0150.00316.86
7.2.30.0060.00616.64
7.2.20.0030.01416.70
7.2.10.0000.01516.80
7.2.00.0100.00818.33
7.1.250.0030.01415.73
7.1.200.0080.00415.85
7.1.100.0070.00717.73
7.1.70.0040.00417.09
7.1.60.0100.01419.70
7.1.50.0090.00916.90
7.1.00.0070.07322.47
7.0.200.0070.00016.62
7.0.140.0100.06721.92
7.0.60.0070.05019.86
7.0.50.0070.08317.73
7.0.40.0070.05020.21
7.0.30.0300.07020.07
7.0.20.0270.04320.05
7.0.10.0230.04320.12
7.0.00.0070.08720.29
5.6.280.0070.06721.14
5.6.210.0030.08320.68
5.6.200.0170.04018.22
5.6.190.0170.07320.67
5.6.180.0130.06320.63
5.6.170.0300.08020.71
5.6.160.0100.05720.46
5.6.150.0070.08018.27
5.6.140.0070.05718.15
5.6.130.0130.07018.20
5.6.120.0100.05720.91
5.6.110.0130.07320.99
5.6.100.0070.08321.10
5.6.90.0070.06721.01
5.6.80.0170.07020.46
5.6.70.4530.03020.39
5.5.350.0000.08020.37
5.5.340.0100.03718.07
5.5.330.0030.08320.40
5.5.320.0300.04720.30
5.5.310.0370.06720.24
5.5.300.0130.07017.95
5.5.290.0030.08717.98
5.5.280.0100.08720.85
5.5.270.0000.05720.77
5.5.260.0070.06020.77
5.5.250.0070.06720.59
5.5.240.0200.06320.20
5.4.450.0200.05319.46
5.4.440.0330.04019.40
5.4.430.0200.04319.38
5.4.420.0270.04019.30
5.4.410.0370.03319.19
5.4.400.0200.04719.20
5.4.390.0170.03318.88
5.4.380.0170.05318.52
5.4.370.0100.05718.51
5.4.360.0130.05318.71
5.4.350.0100.05718.84
5.4.340.0200.06018.59
5.4.320.0070.03612.51
5.4.310.0060.05112.51
5.4.300.0020.04112.51
5.4.290.0060.03712.50
5.4.280.0100.03112.41
5.4.270.0100.04412.41
5.4.260.0110.03612.40
5.4.250.0030.04512.41
5.4.240.0080.04912.41
5.4.230.0080.05212.39
5.4.220.0080.04412.39
5.4.210.0090.03712.40
5.4.200.0120.03612.40
5.4.190.0100.03512.40
5.4.180.0140.05712.39
5.4.170.0110.04512.40
5.4.160.0070.03712.40
5.4.150.0080.04312.39
5.4.140.0080.04512.08
5.4.130.0050.04312.07
5.4.120.0080.04312.02
5.4.110.0090.03312.02
5.4.100.0040.03912.02
5.4.90.0070.03612.02
5.4.80.0070.03812.02
5.4.70.0060.04312.02
5.4.60.0080.05112.02
5.4.50.0090.03412.02
5.4.40.0070.03512.00
5.4.30.0080.04012.00
5.4.20.0070.04012.00
5.4.10.0070.03712.00
5.4.00.0050.04011.49
5.3.290.0030.04112.80
5.3.280.0060.04312.71
5.3.270.0100.03812.72
5.3.260.0050.04212.72
5.3.250.0080.03612.72
5.3.240.0080.03712.72
5.3.230.0100.03512.71
5.3.220.0060.04012.68
5.3.210.0060.04312.68
5.3.200.0100.04612.68
5.3.190.0060.04212.68
5.3.180.0090.03512.67
5.3.170.0060.03712.67
5.3.160.0050.03912.67
5.3.150.0030.04212.68
5.3.140.0100.04312.66
5.3.130.0040.04212.66
5.3.120.0070.04012.66
5.3.110.0030.04312.66
5.3.100.0040.04312.12
5.3.90.0090.03912.09
5.3.80.0070.03612.07
5.3.70.0060.03712.07
5.3.60.0110.03412.07
5.3.50.0080.04812.00
5.3.40.0130.04012.00
5.3.30.0090.04011.95
5.3.20.0060.04911.73
5.3.10.0070.05011.70
5.3.00.0050.04011.68
5.2.170.0060.0329.18
5.2.160.0050.0329.19
5.2.150.0050.0339.18
5.2.140.0050.0369.18
5.2.130.0040.0329.14
5.2.120.0060.0309.14
5.2.110.0100.0319.14
5.2.100.0030.0329.14
5.2.90.0080.0429.15
5.2.80.0060.0349.14
5.2.70.0040.0379.14
5.2.60.0070.0329.09
5.2.50.0070.0339.06
5.2.40.0100.0349.03
5.2.30.0070.0509.01
5.2.20.0080.0479.00
5.2.10.0090.0408.93
5.2.00.0100.0378.79
5.1.60.0070.0368.07
5.1.50.0060.0308.07
5.1.40.0060.0338.04
5.1.30.0100.0348.40
5.1.20.0040.0458.42
5.1.10.0050.0428.14
5.1.00.0100.0458.14
5.0.50.0110.0336.63
5.0.40.0040.0216.48
5.0.30.0050.0316.29
5.0.20.0010.0236.27
5.0.10.0010.0246.24
5.0.00.0050.0366.24
4.4.90.0090.0224.78
4.4.80.0030.0254.75
4.4.70.0030.0234.75
4.4.60.0050.0204.76
4.4.50.0050.0214.77
4.4.40.0030.0384.71
4.4.30.0080.0314.76
4.4.20.0030.0184.85
4.4.10.0050.0164.85
4.4.00.0040.0274.76
4.3.110.0010.0254.67
4.3.100.0030.0184.66
4.3.90.0030.0164.63
4.3.80.0040.0254.58
4.3.70.0020.0164.63
4.3.60.0020.0204.62
4.3.50.0020.0194.62
4.3.40.0030.0264.54
4.3.30.0040.0183.29
4.3.20.0030.0293.26
4.3.10.0020.0223.22
4.3.00.0030.02051.50