3v4l.org

run code in 300+ PHP versions simultaneously
<?php DEFINE('FILTER_OPTIONS', ['odd', 'even']); /* Array filtering * * @param $array array the input array * @param $filterParameter string 'odd' or 'even' * * @return array|bool it returns the filtered array. In any other case it should return false. */ function filterArray($array, $filterParameter) { if (! is_array($array) || ! in_array($filterParameter, FILTER_OPTIONS)) { return false; } return array_filter($array, function ($e) use ($filterParameter) { return $filterParameter === 'odd' ? $e % 2 === 1 : $e % 2 === 0; }); } $array = [1,2,3,4,5,6,7]; var_dump(filterArray($array, 'odd'));

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.0150.00718.50
8.3.50.0190.00316.48
8.3.40.0070.00718.89
8.3.30.0070.00718.71
8.3.20.0040.00420.34
8.3.10.0080.00021.71
8.3.00.0060.00319.56
8.2.180.0100.01016.75
8.2.170.0110.00322.96
8.2.160.0070.00719.26
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00419.64
8.2.120.0000.00726.35
8.2.110.0060.00321.18
8.2.100.0130.00017.53
8.2.90.0040.00417.91
8.2.80.0090.00017.97
8.2.70.0030.00618.05
8.2.60.0050.00318.16
8.2.50.0080.00018.10
8.2.40.0000.00822.36
8.2.30.0040.00419.15
8.2.20.0040.00418.12
8.2.10.0000.00818.14
8.2.00.0040.00418.13
8.1.280.0140.00325.92
8.1.270.0050.00222.08
8.1.260.0070.00026.35
8.1.250.0000.00828.09
8.1.240.0070.01023.92
8.1.230.0120.00022.62
8.1.220.0070.00317.77
8.1.210.0030.00518.79
8.1.200.0060.00317.35
8.1.190.0050.00317.35
8.1.180.0000.00818.10
8.1.170.0050.00318.78
8.1.160.0000.00719.01
8.1.150.0000.00718.90
8.1.140.0040.00419.51
8.1.130.0060.00318.94
8.1.120.0040.00417.47
8.1.110.0040.00417.45
8.1.100.0060.00317.48
8.1.90.0040.00417.50
8.1.80.0000.00717.50
8.1.70.0050.00217.54
8.1.60.0040.00417.61
8.1.50.0050.00217.44
8.1.40.0080.00017.53
8.1.30.0000.00717.70
8.1.20.0030.00517.68
8.1.10.0020.00517.58
8.1.00.0000.00717.45
8.0.300.0030.00619.64
8.0.290.0080.00016.75
8.0.280.0040.00418.37
8.0.270.0070.00017.14
8.0.260.0000.00918.83
8.0.250.0030.00316.86
8.0.240.0030.00516.86
8.0.230.0030.00316.88
8.0.220.0000.00716.90
8.0.210.0030.00316.83
8.0.200.0030.00316.87
8.0.190.0040.00816.87
8.0.180.0040.00416.93
8.0.170.0070.00016.86
8.0.160.0070.00016.89
8.0.150.0000.00716.88
8.0.140.0040.00416.80
8.0.130.0030.00313.34
8.0.120.0030.00516.88
8.0.110.0050.00216.76
8.0.100.0070.00016.87
8.0.90.0000.00716.70
8.0.80.0060.00916.90
8.0.70.0000.00716.72
8.0.60.0040.00416.84
8.0.50.0000.00817.00
8.0.30.0100.00917.04
8.0.20.0070.01117.40
8.0.10.0000.00717.09
8.0.00.0030.01516.92
7.4.330.0000.00515.55
7.4.320.0030.00316.62
7.4.300.0030.00316.61
7.4.290.0000.00716.61
7.4.280.0050.00316.61
7.4.270.0040.00416.51
7.4.260.0000.00816.51
7.4.250.0030.00316.58
7.4.240.0040.00416.52
7.4.230.0070.00016.43
7.4.220.0100.01016.54
7.4.210.0090.00916.63
7.4.200.0030.00316.41
7.4.160.0100.00716.58
7.4.150.0090.01117.40
7.4.140.0080.01017.86
7.4.130.0130.00616.45
7.4.120.0090.01116.60
7.4.110.0030.01316.51
7.4.100.0200.00416.62
7.4.90.0080.01216.40
7.4.80.0150.00319.39
7.4.70.0140.00316.39
7.4.60.0110.00716.38
7.4.50.0040.01116.53
7.4.40.0090.00916.55
7.4.30.0170.00316.45
7.4.00.0000.01515.05
7.3.330.0060.00013.14
7.3.320.0000.00513.14
7.3.310.0060.00016.32
7.3.300.0070.00016.31
7.3.290.0060.00716.35
7.3.280.0060.01116.37
7.3.270.0140.00317.40
7.3.260.0080.00916.53
7.3.250.0060.01216.51
7.3.240.0090.01016.50
7.3.230.0170.00016.63
7.3.210.0100.00716.61
7.3.200.0030.01316.35
7.3.190.0100.00716.28
7.3.180.0000.01716.38
7.3.170.0060.01616.30
7.3.160.0040.01216.43
7.3.120.0080.00614.97
7.3.110.0090.00614.62
7.3.100.0050.01214.74
7.3.90.0080.00714.66
7.3.80.0060.00914.88
7.3.70.0050.00814.79
7.3.60.0100.00314.87
7.3.50.0040.01014.88
7.3.40.0110.00614.66
7.3.30.0070.01014.94
7.3.20.0090.00716.73
7.3.10.0040.01116.67
7.3.00.0050.00716.72
7.2.330.0030.01316.82
7.2.320.0120.00616.70
7.2.310.0060.01016.34
7.2.300.0040.01316.84
7.2.290.0100.01216.77
7.2.240.0050.01114.97
7.2.230.0100.01015.19
7.2.220.0030.01115.06
7.2.210.0090.00615.12
7.2.200.0080.00815.02
7.2.190.0050.00615.00
7.2.180.0080.00614.91
7.2.170.0030.00814.83
7.2.160.0050.00715.21
7.2.150.0070.00416.89
7.2.140.0070.00616.89
7.2.130.0100.00316.83
7.2.120.0080.00716.93
7.2.110.0060.00816.88
7.2.100.0120.00316.78
7.2.90.0060.00916.91
7.2.80.0090.00716.97
7.2.70.0070.00716.81
7.2.60.0060.00916.76
7.2.50.0070.00916.92
7.2.40.0060.00616.92
7.2.30.0080.00816.86
7.2.20.0080.00716.87
7.2.10.0060.00616.93
7.2.00.0040.01116.81
7.1.330.0050.00815.91
7.1.320.0030.00915.91
7.1.310.0080.00815.87
7.1.300.0070.00915.55
7.1.290.0080.00615.73
7.1.280.0040.01115.76
7.1.270.0120.00015.73
7.1.260.0100.00515.68
7.1.250.0050.00815.83
7.1.200.0140.00016.01
7.1.70.0530.01015.36
7.1.60.0720.00333.34
7.1.50.0660.01633.07
7.1.40.0620.01032.54
7.1.30.0680.01732.77
7.1.20.0260.00734.69
7.1.10.0040.01116.64
7.1.00.0060.00916.80
7.0.200.0560.01014.93
7.0.190.0640.01014.81
7.0.180.0610.00014.33
7.0.170.0690.00616.19
7.0.160.0070.00716.27
7.0.150.0030.01016.41
7.0.140.0160.00016.20
7.0.130.0060.01016.52
7.0.120.0070.00716.40
7.0.110.0100.00316.24
7.0.100.0090.00616.18
7.0.90.0100.00316.06
7.0.80.0070.00716.33
7.0.70.0000.01316.23
7.0.60.0060.00816.29
7.0.50.0000.01416.27
7.0.40.0030.01016.41
7.0.30.0060.01116.55
7.0.20.0060.00916.34
7.0.10.0070.00716.45
7.0.00.0100.00316.46

preferences:
50.78 ms | 400 KiB | 5 Q