3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array( 0 => 15, 1 => 6, 2 => 19, 3 => 21, 4 => 18 ); function find_closest($arr,$x){ sort($arr); $filtered_array = array_filter($arr,function($v)use($x){ return $v < $x; }); return count($filtered_array) > 0 ? end($filtered_array) : "Your Message"; } echo find_closest($arr,17)."\n"; echo find_closest($arr,20)."\n"; echo find_closest($arr,6);

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.5.00.0130.01420.04
8.4.150.0020.00114.05
8.4.140.0140.00917.46
8.4.130.0140.00617.69
8.4.120.0050.00320.80
8.4.110.0060.00222.25
8.4.100.0110.01017.78
8.4.90.0110.00920.43
8.4.80.0050.00318.82
8.4.70.0030.00518.83
8.4.60.0050.00620.59
8.4.50.0130.00717.98
8.4.40.0050.00517.59
8.4.30.0130.00717.42
8.4.20.0100.01017.52
8.4.10.0090.00017.69
8.3.280.0110.00918.49
8.3.270.0120.00916.29
8.3.260.0130.00716.70
8.3.250.0130.00618.97
8.3.240.0120.00616.51
8.3.230.0050.00316.53
8.3.220.0100.00918.66
8.3.210.0110.00916.54
8.3.200.0040.00416.50
8.3.190.0060.00418.86
8.3.180.0100.00818.95
8.3.170.0100.01018.33
8.3.160.0060.00916.42
8.3.150.0080.00818.80
8.3.140.0090.00916.66
8.3.130.0050.00318.24
8.3.120.0060.00320.66
8.3.110.0110.00720.94
8.3.100.0090.00024.06
8.3.90.0120.00326.77
8.3.80.0030.01017.97
8.3.70.0070.01418.18
8.3.60.0070.01116.38
8.3.50.0120.01021.99
8.3.40.0120.00318.81
8.3.30.0110.00418.71
8.3.20.0080.00020.16
8.3.10.0000.00823.53
8.3.00.0080.00019.00
8.2.290.0090.00920.72
8.2.280.0120.00720.28
8.2.270.0070.01116.85
8.2.260.0080.00318.92
8.2.250.0080.00016.67
8.2.240.0100.00016.93
8.2.230.0060.00322.58
8.2.220.0090.00037.54
8.2.210.0080.00026.77
8.2.200.0060.00316.63
8.2.190.0090.00616.58
8.2.180.0070.00716.63
8.2.170.0120.00322.96
8.2.160.0070.00719.41
8.2.150.0030.00524.18
8.2.140.0070.00024.66
8.2.130.0000.00726.16
8.2.120.0070.00717.50
8.2.110.0030.00721.94
8.2.100.0040.00818.05
8.2.90.0070.00019.22
8.2.80.0090.00017.97
8.2.70.0030.00517.49
8.2.60.0060.00317.93
8.2.50.0090.00018.07
8.2.40.0050.00219.34
8.2.30.0030.00320.70
8.2.20.0080.00017.65
8.2.10.0000.00718.04
8.2.00.0030.00618.13
8.1.330.0090.00816.73
8.1.320.0100.00817.63
8.1.310.0050.00316.57
8.1.300.0070.00015.83
8.1.290.0080.00030.84
8.1.280.0120.00925.92
8.1.270.0080.00023.91
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00622.53
8.1.230.0040.00817.68
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0040.00817.35
8.1.190.0090.00017.35
8.1.180.0040.00418.10
8.1.170.0060.00319.03
8.1.160.0070.00022.02
8.1.150.0040.00420.63
8.1.140.0030.00619.65
8.1.130.0000.00717.64
8.1.120.0040.00417.38
8.1.110.0040.00417.50
8.1.100.0040.00417.47
8.1.90.0080.00017.38
8.1.80.0030.00317.52
8.1.70.0040.00417.53
8.1.60.0050.00217.64
8.1.50.0040.00417.59
8.1.40.0030.00617.52
8.1.30.0000.00817.71
8.1.20.0070.00017.60
8.1.10.0000.00817.48
8.1.00.0040.00417.33
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.38
8.0.270.0000.00717.27
8.0.260.0030.00317.27
8.0.250.0050.00317.03
8.0.240.0000.00717.02
8.0.230.0080.00016.96
8.0.220.0040.00416.86
8.0.210.0080.00016.86
8.0.200.0000.00716.96
8.0.190.0050.00316.97
8.0.180.0000.01116.85
8.0.170.0060.00316.79
8.0.160.0040.00416.82
8.0.150.0050.00316.85
8.0.140.0050.00316.85
8.0.130.0000.00613.39
8.0.120.0040.00416.88
8.0.110.0000.00716.88
8.0.100.0040.00416.96
8.0.90.0070.00016.89
8.0.80.0040.01516.86
8.0.70.0080.00016.97
8.0.60.0000.00716.85
8.0.50.0040.00416.71
8.0.30.0080.01116.93
8.0.20.0130.01017.42
8.0.10.0040.00417.03
8.0.00.0110.00616.86
7.4.330.0060.00015.08
7.4.320.0000.00816.46
7.4.300.0060.00016.52
7.4.290.0070.00016.38
7.4.280.0000.00716.60
7.4.270.0040.00416.68
7.4.260.0000.00716.62
7.4.250.0000.00716.41
7.4.240.0050.00216.52
7.4.230.0000.00716.61
7.4.220.0100.01016.66
7.4.210.0050.01216.61
7.4.200.0040.00416.64
7.4.160.0090.00616.46
7.4.150.0110.01117.40
7.4.140.0140.00917.86
7.4.130.0050.01416.57
7.4.120.0090.00716.57
7.4.110.0130.01016.53
7.4.100.0120.00716.37
7.4.90.0130.00516.47
7.4.80.0130.01019.39
7.4.70.0030.01916.52
7.4.60.0090.00616.61
7.4.50.0040.00416.37
7.4.40.0060.00916.48
7.4.30.0090.00616.60
7.4.10.0060.00915.71
7.4.00.0060.00815.44
7.3.330.0030.00313.26
7.3.320.0000.00813.12
7.3.310.0030.00316.19
7.3.300.0030.00316.35
7.3.290.0040.00416.16
7.3.280.0090.00816.30
7.3.270.0000.01617.40
7.3.260.0140.00316.55
7.3.250.0110.00616.41
7.3.240.0150.00216.51
7.3.230.0110.00616.54
7.3.210.0120.00916.54
7.3.200.0030.01316.61
7.3.190.0060.00916.60
7.3.180.0130.00316.55
7.3.170.0060.01316.29
7.3.160.0120.00616.28
7.3.130.0050.01215.66
7.3.120.0080.00515.46
7.3.110.0070.00815.60
7.3.100.0050.01015.52
7.3.90.0090.00915.63
7.3.80.0070.00415.54
7.3.70.0050.00715.55
7.3.60.0080.00115.46
7.3.50.0020.01015.58
7.3.40.0060.00815.57
7.3.30.0050.00615.59
7.3.20.0030.01117.54
7.3.10.0030.01017.02
7.3.00.0070.00717.03
7.2.330.0030.01516.78
7.2.320.0080.00816.50
7.2.310.0110.00916.63
7.2.300.0210.02416.48
7.2.290.0070.01016.74
7.2.260.0090.00616.02
7.2.250.0070.01015.87
7.2.240.0030.00815.79
7.2.230.0020.01215.83
7.2.220.0070.00815.67
7.2.210.0080.00515.86
7.2.200.0070.00615.83
7.2.190.0030.01215.78
7.2.180.0050.00615.93
7.2.170.0050.00915.88
7.2.160.0090.00215.89
7.2.150.0020.01117.79
7.2.140.0060.00717.70
7.2.130.0050.01017.32
7.2.120.0060.00817.27
7.2.110.0070.00617.21
7.2.100.0060.00717.34
7.2.90.0240.00916.75
7.2.80.0250.00916.62
7.2.70.0240.00516.78
7.2.60.0160.00716.78
7.2.50.0310.00716.78
7.2.40.0120.00716.83
7.2.30.0090.00616.89
7.2.20.0220.00516.82
7.2.10.0090.00816.77
7.2.00.0230.00917.21
7.1.330.0050.00916.46
7.1.320.0050.00716.66
7.1.310.0000.01416.69
7.1.300.0060.00616.62
7.1.290.0010.01216.63
7.1.280.0060.00816.64
7.1.270.0040.00916.59
7.1.260.0090.00216.59
7.1.250.0030.01016.13
7.1.240.0070.00716.49
7.1.230.0050.00816.45
7.1.220.0050.01016.56
7.1.210.0490.00315.61
7.1.200.0370.01015.48
7.1.190.0080.00815.69
7.1.180.0180.00815.69
7.1.170.0150.00315.61
7.1.160.0480.00615.66
7.1.150.0400.00815.54
7.1.140.0400.00615.65
7.1.130.0240.01115.46
7.1.120.0090.00815.67
7.1.110.0250.00815.72
7.1.100.0270.00916.36
7.1.90.0510.00615.63
7.1.80.0450.00715.50
7.1.70.0380.00716.01
7.1.60.0270.01021.08
7.1.50.0220.00920.55
7.1.40.0140.00921.61
7.1.30.0210.01221.63
7.1.20.0170.01021.72
7.1.10.0070.00915.59
7.1.00.0320.02417.26
7.0.330.0060.00816.19
7.0.320.0070.00616.15
7.0.310.0670.00715.25
7.0.300.0540.00615.23
7.0.290.0440.00615.10
7.0.280.0310.00915.19
7.0.270.0100.00515.31
7.0.260.0340.01115.21
7.0.250.0050.00815.27
7.0.240.0440.01015.31
7.0.230.0360.00815.19
7.0.220.0460.00915.17
7.0.210.0450.00715.22
7.0.200.0330.00915.12
7.0.190.0050.00915.25
7.0.180.0320.00615.13
7.0.170.0060.00715.27
7.0.160.0300.00715.27
7.0.150.0290.00515.08
7.0.140.0270.00815.41
7.0.130.0220.00415.30
7.0.120.0110.00815.32
7.0.110.0130.00715.12
7.0.100.0130.00715.26
7.0.90.0080.00715.17
7.0.80.0350.00815.16
7.0.70.0310.00915.35
7.0.60.0100.01616.42
7.0.50.0360.02716.00
7.0.40.0300.02715.48
7.0.30.0370.01415.53
7.0.20.0380.02615.51
7.0.10.0270.02615.58
7.0.00.0270.02815.57
5.6.400.0080.00615.08
5.6.390.0040.01215.10
5.6.380.0020.01115.05
5.6.370.0050.00815.20
5.6.360.0110.00515.14
5.6.350.0050.00814.91
5.6.340.0040.00915.21
5.6.330.0080.00815.08
5.6.320.0050.00815.08
5.6.310.0070.00715.35
5.6.300.0010.01114.98
5.6.290.0100.00414.84
5.6.280.0080.02016.34
5.6.270.0100.00714.62
5.6.260.0050.01014.89
5.6.250.0060.00614.85
5.6.240.0090.00614.84
5.6.230.0070.00614.71
5.6.220.0050.01014.98
5.6.210.0070.02416.16
5.6.200.0040.02515.75
5.6.190.0100.02216.26
5.6.180.0930.01816.19
5.6.170.0190.01216.31
5.6.160.0120.01816.18
5.6.150.0070.02815.62
5.6.140.0060.02115.74
5.6.130.0040.02515.66
5.6.120.0110.02616.28
5.6.110.0070.02416.40
5.6.100.0090.02416.33
5.6.90.0080.02616.31
5.6.80.0100.01316.14
5.6.70.0040.00814.75
5.6.60.0070.00714.89
5.6.50.0080.00814.58
5.6.40.0080.00814.75
5.6.30.0090.00414.78
5.6.20.0070.00914.70
5.6.10.0070.00914.69
5.6.00.0060.00714.70
5.5.380.0080.00313.76
5.5.370.0050.00613.66
5.5.360.0090.00613.79
5.5.350.0880.01515.50
5.5.340.0060.01414.84
5.5.330.0050.02315.46
5.5.320.0110.02215.42
5.5.310.0120.02415.36
5.5.300.0090.02514.92
5.5.290.0070.02214.86
5.5.280.0070.02315.61
5.5.270.0060.02815.57
5.5.260.0040.02815.47
5.5.250.0060.03015.48
5.5.240.0070.02215.26
5.5.230.0070.00513.56
5.5.220.0020.01113.74
5.5.210.0060.00513.86
5.5.200.0040.00813.67
5.5.190.0030.00913.68
5.5.180.0080.00513.79
5.5.170.0080.00614.75
5.5.160.0080.00413.62
5.5.150.0080.00413.61
5.5.140.0080.00613.82
5.5.130.0060.00813.76
5.5.120.0070.00413.73
5.5.110.0040.01113.62
5.5.100.0050.01313.59
5.5.90.0090.00713.75
5.5.80.0070.00713.72
5.5.70.0050.00713.56
5.5.60.0080.00613.54
5.5.50.0070.00713.65
5.5.40.0090.00713.73
5.5.30.0070.00613.63
5.5.20.0070.00513.71
5.5.10.0050.00713.72
5.5.00.0050.00813.57
5.4.450.0040.03013.68
5.4.440.0060.02013.69
5.4.430.0090.02013.58
5.4.420.0080.01713.66
5.4.410.0090.01813.58
5.4.400.0100.02013.40
5.4.390.0090.01813.48
5.4.380.0080.01713.45
5.4.370.0110.01313.39
5.4.360.0070.01713.61
5.4.350.0070.02013.46
5.4.340.0070.02013.58
5.4.330.0040.00411.61
5.4.320.0070.01813.46
5.4.310.0100.01513.42
5.4.300.0080.01713.48
5.4.290.0080.01713.54
5.4.280.0060.01813.45
5.4.270.0080.01713.54
5.4.260.0090.01713.49
5.4.250.0050.02313.39
5.4.240.0070.01713.39
5.4.230.0070.01713.57
5.4.220.0090.02013.51
5.4.210.0060.02013.28
5.4.200.0130.01113.45
5.4.190.0110.01513.49
5.4.180.0040.02113.45
5.4.170.0070.01813.30
5.4.160.0100.01613.52
5.4.150.0120.01513.37
5.4.140.0080.01812.91
5.4.130.0080.01512.84
5.4.120.0050.01912.79
5.4.110.0090.01612.90
5.4.100.0030.02012.76
5.4.90.0070.01712.84
5.4.80.0070.01912.77
5.4.70.0080.01812.84
5.4.60.0090.01512.79
5.4.50.0050.01912.75
5.4.40.0100.01512.75
5.4.30.0060.02012.79
5.4.20.0070.01912.88
5.4.10.0100.01812.77
5.4.00.0110.01512.59

preferences:
96.24 ms | 403 KiB | 5 Q