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 PHP_EOL . '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.0130.00316.75
8.3.50.0120.00318.06
8.3.40.0040.01118.96
8.3.30.0070.00719.05
8.3.20.0040.00420.31
8.3.10.0080.00023.48
8.3.00.0080.00020.97
8.2.180.0060.00916.63
8.2.170.0110.00422.96
8.2.160.0100.00322.26
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0040.00420.90
8.2.110.0030.00722.16
8.2.100.0060.00617.84
8.2.90.0060.00319.13
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0000.00817.93
8.2.50.0000.00818.07
8.2.40.0040.00420.07
8.2.30.0040.00418.27
8.2.20.0080.00017.65
8.2.10.0070.00018.10
8.2.00.0080.00017.64
8.1.270.0050.00323.96
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00022.19
8.1.230.0080.00319.01
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0000.00917.25
8.1.190.0030.00517.25
8.1.180.0030.00618.10
8.1.170.0000.00918.59
8.1.160.0000.00821.95
8.1.150.0000.00718.62
8.1.140.0070.00017.38
8.1.130.0030.00317.83
8.1.120.0030.00717.53
8.1.110.0000.00817.45
8.1.100.0000.00817.41
8.1.90.0040.00417.39
8.1.80.0040.00417.52
8.1.70.0000.00817.44
8.1.60.0060.00617.62
8.1.50.0000.00917.54
8.1.40.0050.00317.45
8.1.30.0000.00817.66
8.1.20.0040.00417.51
8.1.10.0030.00617.61
8.1.00.0000.00817.54
8.0.300.0000.00718.77
8.0.290.0070.00017.17
8.0.280.0000.00718.42
8.0.270.0030.00316.80
8.0.260.0050.00217.32
8.0.250.0000.00717.01
8.0.240.0070.00017.10
8.0.230.0000.00817.00
8.0.220.0030.00317.03
8.0.210.0050.00216.96
8.0.200.0030.00317.06
8.0.190.0040.00416.90
8.0.180.0070.00016.95
8.0.170.0050.00216.90
8.0.160.0000.00816.98
8.0.150.0050.00316.89
8.0.140.0040.00416.84
8.0.130.0030.00313.42
8.0.120.0080.00016.81
8.0.110.0040.00416.93
8.0.100.0050.00216.97
8.0.90.0000.00816.96
8.0.80.0040.01116.89
8.0.70.0040.00417.08
8.0.60.0030.00516.83
8.0.50.0000.00816.96
8.0.30.0110.00617.09
8.0.20.0100.00817.40
8.0.10.0080.00016.98
8.0.00.0080.01116.75
7.4.330.0000.00515.00
7.4.320.0000.00616.53
7.4.300.0030.00316.57
7.4.290.0040.00416.66
7.4.280.0000.00716.41
7.4.270.0000.00716.66
7.4.260.0000.00716.52
7.4.250.0000.00716.59
7.4.240.0000.00716.48
7.4.230.0040.00416.52
7.4.220.0090.00916.50
7.4.210.0060.00816.61
7.4.200.0070.00016.43
7.4.190.0030.00316.68
7.4.160.0140.00716.45
7.4.150.0120.00617.40
7.4.140.0110.00617.86
7.4.130.0090.01016.56
7.4.120.0090.00916.50
7.4.110.0130.01616.67
7.4.100.0070.01016.43
7.4.90.0090.00616.59
7.4.80.0150.00919.39
7.4.70.0070.00916.63
7.4.60.0180.00016.72
7.4.50.0080.00016.64
7.4.40.0050.01116.50
7.4.30.0090.00616.45
7.4.10.0040.01415.00
7.4.00.0080.01014.98
7.3.330.0000.00713.39
7.3.320.0030.00213.22
7.3.310.0050.00316.20
7.3.300.0000.00616.24
7.3.290.0110.01016.32
7.3.280.0080.01016.41
7.3.270.0070.01017.40
7.3.260.0140.01016.61
7.3.250.0090.00916.48
7.3.240.0070.01116.35
7.3.230.0070.01016.52
7.3.210.0100.00716.49
7.3.200.0120.00719.39
7.3.190.0090.01216.39
7.3.180.0100.00616.49
7.3.170.0100.01316.55
7.3.160.0190.00316.56
7.3.130.0090.00714.75
7.3.120.0100.00714.85
7.3.110.0030.01514.95
7.3.100.0060.00614.90
7.3.90.0040.01114.63
7.3.80.0000.01514.86
7.3.70.0040.00414.59
7.3.60.0130.00014.67
7.3.50.0040.01514.98
7.3.40.0000.01014.67
7.3.30.0030.00914.85
7.3.20.0090.00316.72
7.3.10.0150.00316.66
7.3.00.0040.00716.69
7.2.330.0040.01416.84
7.2.320.0060.01216.86
7.2.310.0080.00816.50
7.2.300.0130.00316.53
7.2.290.0090.00916.70
7.2.260.0120.00415.28
7.2.250.0110.00315.00
7.2.240.0090.00614.95
7.2.230.0090.00614.91
7.2.220.0030.00715.34
7.2.210.0000.00915.06
7.2.200.0040.01115.15
7.2.190.0100.00715.09
7.2.180.0100.00715.01
7.2.170.0060.00614.92
7.2.160.0040.00814.98
7.2.150.0060.01216.67
7.2.140.0060.01216.75
7.2.130.0040.01116.70
7.2.120.0000.01017.03
7.2.110.0100.00716.99
7.2.100.0030.01016.70
7.2.90.0090.00017.08
7.2.80.0090.00016.81
7.2.70.0130.00317.10
7.2.60.0040.00917.00
7.2.50.0100.00317.04
7.2.40.0030.01016.70
7.2.30.0030.00716.97
7.2.20.0090.00616.63
7.2.10.0040.01117.13
7.2.00.0030.01016.95
7.1.330.0060.00615.77
7.1.320.0090.00315.82
7.1.310.0110.00315.71
7.1.300.0110.00715.66
7.1.290.0080.00815.77
7.1.280.0000.01415.79
7.1.270.0000.01415.79
7.1.260.0030.01215.66
7.1.250.0030.01015.82
7.1.240.0040.01215.70
7.1.230.0030.00715.86
7.1.220.0000.00915.73
7.1.210.0000.01215.55
7.1.200.0050.00815.77
7.1.190.0050.00515.56
7.1.180.0080.00015.63
7.1.170.0090.00615.88
7.1.160.0100.00315.69
7.1.150.0000.01415.82
7.1.140.0100.00315.84
7.1.130.0140.00015.62
7.1.120.0040.01115.72
7.1.110.0070.01015.77
7.1.100.0060.00615.77
7.1.90.0050.00515.90
7.1.80.0030.01015.66
7.1.70.0010.01016.39
7.1.60.0070.00516.50
7.1.50.0000.01816.34
7.1.40.0040.00815.84
7.1.30.0030.01015.76
7.1.20.0060.00615.73
7.1.10.0030.00915.73
7.1.00.0030.04319.02
7.0.330.0030.01015.18
7.0.320.0000.01215.46
7.0.310.0060.00615.43
7.0.300.0030.00915.32
7.0.290.0120.00415.53
7.0.280.0070.00315.26
7.0.270.0100.00015.46
7.0.260.0080.00615.29
7.0.250.0090.00315.49
7.0.240.0070.00315.28
7.0.230.0070.00715.34
7.0.220.0000.01215.17
7.0.210.0040.00415.40
7.0.200.0020.00816.24
7.0.190.0030.00915.50
7.0.180.0070.00715.37
7.0.170.0060.00615.27
7.0.160.0100.00615.24
7.0.150.0070.00315.30
7.0.140.0070.03818.63
7.0.130.0000.01215.54
7.0.120.0030.01015.61
7.0.110.0000.00815.50
7.0.100.0200.03117.75
7.0.90.0130.02317.61
7.0.80.0080.03217.71
7.0.70.0100.02517.62
7.0.60.0100.03817.67
7.0.50.0030.04718.01
7.0.40.0050.04716.73
7.0.30.0070.03516.71
7.0.20.0050.04316.77
7.0.10.0080.02316.87
7.0.00.0100.04216.78
5.6.400.0000.01113.97
5.6.390.0060.00614.27
5.6.380.0070.00714.64
5.6.370.0100.00314.61
5.6.360.0060.00914.62
5.6.350.0040.01114.42
5.6.340.0040.01214.41
5.6.330.0030.01114.27
5.6.320.0000.01314.09
5.6.310.0090.00614.73
5.6.300.0000.01314.42
5.6.290.0100.00414.47
5.6.280.0030.04017.59
5.6.270.0070.00714.08
5.6.260.0080.00414.46
5.6.250.0030.04817.46
5.6.240.0070.03517.28
5.6.230.0050.02517.54
5.6.220.0060.04017.51
5.6.210.0100.04217.34
5.6.200.0110.03517.56
5.6.190.0080.01917.73
5.6.180.0050.04817.68
5.6.170.0110.03017.67
5.6.160.0080.04117.67
5.6.150.0080.04517.63
5.6.140.0110.04017.69
5.6.130.0090.03817.56
5.6.120.0080.02817.76
5.6.110.0080.03217.61
5.6.100.0060.02117.57
5.6.90.0050.02717.66
5.6.80.0020.02217.35
5.6.70.0050.02917.49
5.6.60.0030.03917.33
5.6.50.0100.01917.36
5.6.40.0060.01817.32
5.6.30.0030.02817.37
5.6.20.0020.03217.22
5.6.10.0070.02217.21
5.6.00.0030.02717.32
5.5.380.0090.02517.34
5.5.370.0030.03017.41
5.5.360.0080.04517.43
5.5.350.0080.04117.56
5.5.340.0080.03717.55
5.5.330.0080.02317.75
5.5.320.0060.04117.48
5.5.310.0080.03017.53
5.5.300.0070.02817.57
5.5.290.0100.04517.50
5.5.280.0090.03817.72
5.5.270.0080.02817.53
5.5.260.0080.02817.65
5.5.250.0070.02217.36
5.5.240.0050.02317.26
5.5.230.0080.02117.25
5.5.220.0090.02017.13
5.5.210.0040.04517.32
5.5.200.0030.03017.23
5.5.190.0080.01717.20
5.5.180.0000.02917.08
5.5.170.0050.00514.09
5.5.160.0040.02217.32
5.5.150.0070.02517.25
5.5.140.0080.02017.26
5.5.130.0040.03317.19
5.5.120.0040.02117.30
5.5.110.0050.02517.17
5.5.100.0060.02217.13
5.5.90.0060.01717.16
5.5.80.0070.02217.12
5.5.70.0100.02017.09
5.5.60.0060.02117.24
5.5.50.0050.02217.18
5.5.40.0040.02417.21
5.5.30.0070.02217.33
5.5.20.0050.02517.13
5.5.10.0070.02017.03
5.5.00.0040.02617.07
5.4.450.0040.04515.51
5.4.440.0050.02515.57
5.4.430.0070.02215.45
5.4.420.0030.02315.53
5.4.410.0050.02015.53
5.4.400.0050.02315.27
5.4.390.0030.01815.39
5.4.380.0070.03015.44
5.4.370.0000.02815.30
5.4.360.0040.02215.25
5.4.350.0040.02015.39
5.4.340.0020.02315.43
5.4.330.0030.00311.64
5.4.320.0030.02415.41
5.4.310.0020.02715.34
5.4.300.0060.02115.34
5.4.290.0030.02015.44
5.4.280.0020.02115.33
5.4.270.0010.02315.24
5.4.260.0000.02515.42
5.4.250.0060.01715.25
5.4.240.0050.02215.38
5.4.230.0020.02215.38
5.4.220.0050.02215.33
5.4.210.0050.03315.37
5.4.200.0060.02015.44
5.4.190.0030.02315.28
5.4.180.0070.01715.33
5.4.170.0050.01815.38
5.4.160.0050.02215.26
5.4.150.0060.01815.37
5.4.140.0030.02514.08
5.4.130.0030.02213.94
5.4.120.0030.01614.01
5.4.110.0030.02014.02
5.4.100.0050.01814.03
5.4.90.0050.02014.06
5.4.80.0050.01414.05
5.4.70.0100.03314.09
5.4.60.0110.02813.97
5.4.50.0070.03714.04
5.4.40.0060.04114.00
5.4.30.0050.01813.98
5.4.20.0000.02414.06
5.4.10.0050.04214.02
5.4.00.0070.03813.75
5.3.290.0000.04314.52
5.3.280.0070.03714.45
5.3.270.0000.03314.57
5.3.260.0030.03314.47
5.3.250.0030.03014.58
5.3.240.0030.04014.59
5.3.230.0030.03014.46
5.3.220.0030.03714.54
5.3.210.0030.03014.53
5.3.200.0070.02714.56
5.3.190.0030.04014.53
5.3.180.0000.03314.42
5.3.170.0000.03314.42
5.3.160.0070.07314.56
5.3.150.0030.05314.55
5.3.140.0070.04714.55
5.3.130.0030.07714.54
5.3.120.0100.05714.55
5.3.110.0070.08014.54
5.3.100.0030.07714.00
5.3.90.0000.06313.98
5.3.80.0070.07013.88
5.3.70.0070.03313.87
5.3.60.0000.03713.77
5.3.50.0100.04313.80
5.3.40.0030.07713.93
5.3.30.0030.08013.89
5.3.20.0000.06313.65
5.3.10.0070.05313.56
5.3.00.0000.07013.63
5.2.170.0000.03712.07
5.2.160.0070.04712.07
5.2.150.0030.02712.07
5.2.140.0100.05712.07
5.2.130.0030.06012.07
5.2.120.0000.04012.07
5.2.110.0100.05312.07
5.2.100.0130.04712.07
5.2.90.0070.06012.07
5.2.80.0100.05312.07
5.2.70.0000.04012.07
5.2.60.0030.06012.07
5.2.50.0070.06012.07
5.2.40.0030.05012.07
5.2.30.0100.06012.07
5.2.20.0000.04012.07
5.2.10.0100.05312.07
5.2.00.0030.05012.07
5.1.60.0030.03312.07
5.1.50.0030.03312.07
5.1.40.0030.02312.07
5.1.30.0070.05312.07
5.1.20.0030.03712.07
5.1.10.0170.04012.07
5.1.00.0070.05012.07
5.0.50.0000.04312.07
5.0.40.0030.02012.07
5.0.30.0000.06012.07
5.0.20.0130.03312.07
5.0.10.0000.04012.07
5.0.00.0030.04312.07
4.4.90.0000.03712.07
4.4.80.0070.02712.07
4.4.70.0070.03012.07
4.4.60.0070.01712.07
4.4.50.0030.01712.07
4.4.40.0030.04012.07
4.4.30.0030.01712.07
4.4.20.0000.03712.07
4.4.10.0000.02012.07
4.4.00.0000.03712.07
4.3.110.0030.03012.07
4.3.100.0000.03712.07
4.3.90.0070.02712.07
4.3.80.0030.02312.07
4.3.70.0000.02712.07
4.3.60.0030.03012.07
4.3.50.0030.01712.07
4.3.40.0130.03312.07
4.3.30.0000.01712.07
4.3.20.0030.03312.07
4.3.10.0100.02012.07
4.3.00.0000.02012.07

preferences:
66.23 ms | 400 KiB | 5 Q