3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const X = [ 'code' => 101, 'reason' => 'reason 101', ]; const Y = [ 'code' => 102, 'reason' => 'reason 102', ]; public function getFooConstant($code) { $class = new \ReflectionClass(__CLASS__); $constants = $class->getConstants(); var_dump( $constants ); return array_filter($constants, function($v) use ($code) { return $v['code'] == $code; }, ARRAY_FILTER_USE_VALUE); } } $foo = new Foo(); var_dump( $foo->getFooConstant(101) );

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.0080.00816.75
8.3.50.0120.01022.05
8.3.40.0000.01418.54
8.3.30.0150.00018.89
8.3.20.0070.00020.24
8.3.10.0040.00420.48
8.3.00.0050.00221.91
8.2.180.0070.01116.63
8.2.170.0120.00922.96
8.2.160.0070.00719.41
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00322.25
8.2.120.0070.00026.16
8.2.110.0080.00322.15
8.2.100.0040.00817.84
8.2.90.0050.00318.03
8.2.80.0080.00017.97
8.2.70.0000.00917.80
8.2.60.0040.00417.93
8.2.50.0050.00318.10
8.2.40.0070.00020.51
8.2.30.0040.00419.16
8.2.20.0000.00718.09
8.2.10.0070.00018.02
8.2.00.0050.00317.75
8.1.280.0090.00925.92
8.1.270.0080.00023.95
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00322.41
8.1.230.0040.00722.75
8.1.220.0040.00417.79
8.1.210.0030.00618.91
8.1.200.0000.00817.23
8.1.190.0110.00516.88
8.1.180.0030.00618.10
8.1.170.0000.00818.59
8.1.160.0000.00722.18
8.1.150.0030.00518.83
8.1.140.0070.00019.54
8.1.130.0030.00517.73
8.1.120.0040.00417.48
8.1.110.0060.00317.49
8.1.100.0050.00217.52
8.1.90.0030.00517.54
8.1.80.0000.00717.45
8.1.70.0080.00017.51
8.1.60.0030.00617.68
8.1.50.0070.00017.58
8.1.40.0040.00417.57
8.1.30.0000.00917.66
8.1.20.0000.00817.70
8.1.10.0080.00017.44
8.1.00.0040.00417.38
8.0.300.0000.00719.88
8.0.290.0000.00716.75
8.0.280.0000.00718.51
8.0.270.0080.00017.27
8.0.260.0060.00017.32
8.0.250.0070.00016.93
8.0.240.0020.00516.93
8.0.230.0030.00617.06
8.0.220.0070.00016.93
8.0.210.0050.00316.98
8.0.200.0030.00316.90
8.0.190.0070.00017.05
8.0.180.0000.00716.91
8.0.170.0040.00416.97
8.0.160.0050.00217.02
8.0.150.0040.00416.96
8.0.140.0000.00716.85
8.0.130.0000.00613.41
8.0.120.0080.00016.97
8.0.110.0000.00916.86
8.0.100.0060.00316.85
8.0.90.0030.00416.84
8.0.80.0050.00716.94
8.0.70.0030.00716.99
8.0.60.0000.00716.97
8.0.50.0050.00216.79
8.0.30.0120.00517.14
8.0.20.0130.00917.40
8.0.10.0000.00717.09
8.0.00.0070.01016.52
7.4.330.0000.00515.08
7.4.320.0060.00016.63
7.4.300.0030.00316.60
7.4.290.0070.00016.46
7.4.280.0030.00616.41
7.4.270.0000.00716.51
7.4.260.0000.00716.46
7.4.250.0030.00516.59
7.4.240.0030.00316.70
7.4.230.0030.00516.49
7.4.220.0150.01216.61
7.4.210.0050.01016.64
7.4.200.0000.00716.51
7.4.160.0130.00316.55
7.4.150.0110.00617.40
7.4.140.0090.00917.86
7.4.130.0090.01116.56
7.4.120.0080.01116.37
7.4.110.0110.00816.39
7.4.100.0140.00416.66
7.4.90.0150.00316.42
7.4.80.0130.00319.39
7.4.70.0110.00716.35
7.4.60.0150.00616.57
7.4.50.0040.01116.38
7.4.40.0090.00916.82
7.4.30.0130.00316.42
7.4.00.0090.00915.01
7.3.330.0030.00213.32
7.3.320.0060.00013.39
7.3.310.0070.00016.27
7.3.300.0040.00416.36
7.3.290.0040.00416.36
7.3.280.0080.01216.39
7.3.270.0080.00817.40
7.3.260.0100.01416.55
7.3.250.0070.01116.39
7.3.240.0070.01116.42
7.3.230.0170.00316.41
7.3.210.0080.00816.29
7.3.200.0130.00616.54
7.3.190.0000.01516.37
7.3.180.0160.00016.44
7.3.170.0070.01316.43
7.3.160.0160.00016.50
7.2.330.0070.01116.73
7.2.320.0200.00316.53
7.2.310.0130.00616.64
7.2.300.0120.00616.80
7.2.290.0160.00016.72
7.2.60.0000.01116.91
7.2.00.0000.01219.43
7.1.200.0000.01215.84
7.1.100.0100.00318.15
7.1.70.0100.00017.15
7.1.60.0030.00717.25
7.1.50.0070.01717.13
7.1.00.0030.07722.35
7.0.200.0830.01014.61
7.0.110.0470.05320.22
7.0.100.0330.06720.41
7.0.90.0730.07020.24
7.0.80.0470.05020.31
7.0.70.0370.06720.27
7.0.60.0570.05720.22
7.0.50.0270.06720.26
7.0.40.0400.06020.24
7.0.30.0430.05020.27
7.0.20.0470.05720.23
7.0.10.0370.05320.27
7.0.00.0330.06020.24
5.6.260.0130.08020.95
5.6.250.0130.07021.14
5.6.240.0230.07320.75
5.6.230.0170.05320.81
5.6.220.0000.06721.09
5.6.210.0100.05320.96
5.6.200.0070.06021.01
5.6.190.0270.07720.95
5.6.180.0130.05321.05
5.6.170.0270.05020.86
5.6.160.0070.06021.03
5.6.150.0070.09720.82
5.6.140.0100.08320.98
5.6.130.0200.07321.00
5.6.120.0030.07720.87
5.6.110.0170.07721.07
5.6.100.0200.06720.87
5.6.90.0100.05721.04
5.6.80.0030.05720.32
5.6.70.0100.05320.38
5.6.60.0200.07020.22
5.6.50.0100.05320.27
5.6.40.0100.05720.20
5.6.30.0170.06020.41
5.6.20.0130.05720.36
5.6.10.0070.06320.38
5.6.00.0200.06320.29

preferences:
59.92 ms | 401 KiB | 5 Q