3v4l.org

run code in 300+ PHP versions simultaneously
<?php function in_arrayi($needle, array $haystack, bool $strict = false): bool { if (!is_scalar($needle)) { // throw exception or something because of unsuitable data type } $needle = strtolower($needle); foreach ($haystack as $value) { if (!is_scalar($value)) { continue; } elseif ($strict && strtolower($value) === $needle) { return true; } elseif (!$strict && strtolower($value) == $needle) { return true; } } return false; } $haystack = array('one', 'two', 'three', 'four'); $test_needles = ['onE', 'tWo', 'THREE', 'four', 'five']; foreach ($test_needles as $needle) { echo $needle . ': ' . (in_arrayi($needle, $haystack) ? 'found' : 'missing') . "\n"; }

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.0030.01416.63
8.3.50.0080.00818.17
8.3.40.0140.00718.59
8.3.30.0140.00018.72
8.3.20.0060.00322.34
8.3.10.0060.00320.34
8.3.00.0080.00022.29
8.2.180.0110.00418.54
8.2.170.0090.00922.96
8.2.160.0040.01122.08
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0070.00026.16
8.2.120.0070.00026.16
8.2.110.0030.00720.41
8.2.100.0070.00417.72
8.2.90.0050.00317.91
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0050.00317.80
8.2.50.0050.00318.07
8.2.40.0000.00918.28
8.2.30.0040.00418.08
8.2.20.0040.00418.01
8.2.10.0040.00419.21
8.2.00.0040.00419.20
8.1.280.0040.01425.92
8.1.270.0040.00420.64
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00020.64
8.1.230.0090.00322.13
8.1.220.0030.00517.75
8.1.210.0000.00818.87
8.1.200.0060.00317.34
8.1.190.0030.00617.11
8.1.180.0030.00518.10
8.1.170.0000.00918.55
8.1.160.0050.00218.82
8.1.150.0000.00818.82
8.1.140.0000.00820.91
8.1.130.0040.00417.39
8.1.120.0040.00417.41
8.1.110.0070.00017.49
8.1.100.0040.00417.46
8.1.90.0000.00917.49
8.1.80.0040.00417.55
8.1.70.0040.00417.45
8.1.60.0060.00317.46
8.1.50.0050.00317.38
8.1.40.0060.00317.56
8.1.30.0110.00017.59
8.1.20.0030.00617.65
8.1.10.0080.00017.39
8.1.00.0060.00317.48
8.0.300.0060.00320.04
8.0.290.0040.00816.63
8.0.280.0030.00318.52
8.0.270.0000.00716.84
8.0.260.0040.00416.84
8.0.250.0060.00016.98
8.0.240.0000.00616.86
8.0.230.0030.00316.90
8.0.220.0000.00816.86
8.0.210.0000.00716.95
8.0.200.0040.00416.81
8.0.190.0040.00416.95
8.0.180.0080.00016.91
8.0.170.0040.00416.82
8.0.160.0000.00716.83
8.0.150.0040.00416.79
8.0.140.0000.00716.76
8.0.130.0030.00313.32
8.0.120.0000.00716.86
8.0.110.0000.00716.90
8.0.100.0070.00017.02
8.0.90.0070.00016.77
8.0.80.0040.01116.90
8.0.70.0040.00416.77
8.0.60.0000.00716.98
8.0.50.0000.00716.80
8.0.30.0060.01117.02
8.0.20.0030.01617.09
8.0.10.0000.00817.02
8.0.00.0140.00616.84
7.4.330.0020.00215.55
7.4.320.0070.00016.59
7.4.300.0000.00616.64
7.4.290.0000.00816.47
7.4.280.0000.00816.62
7.4.270.0000.00716.44
7.4.260.0030.00516.53
7.4.250.0070.00016.53
7.4.240.0030.00316.53
7.4.230.0040.00416.35
7.4.220.0030.00316.66
7.4.210.0060.01016.61
7.4.200.0070.00016.73
7.4.130.0110.01116.56
7.4.120.0140.00416.39
7.4.110.0070.01016.60
7.4.100.0090.00916.68
7.4.90.0030.01316.51
7.4.80.0070.01619.39
7.4.70.0080.01216.52
7.4.60.0090.00616.53
7.4.50.0070.00716.36
7.4.40.0100.00716.40
7.4.00.0070.01115.21
7.3.330.0070.00016.22
7.3.320.0000.00613.41
7.3.310.0000.00716.29
7.3.300.0030.00316.28
7.3.290.0000.00816.39
7.3.280.0100.01016.37
7.3.260.0110.01016.45
7.3.240.0120.00516.57
7.3.230.0060.01016.40
7.3.210.0100.00616.32
7.3.200.0030.01316.77
7.3.190.0090.00916.57
7.3.180.0000.01516.57
7.3.170.0080.00816.47
7.3.160.0120.00416.28
7.3.80.0080.00614.98
7.3.70.0090.00314.73
7.3.60.0100.00514.81
7.3.50.0060.00614.80
7.3.40.0060.00914.77
7.3.30.0030.01014.53
7.3.20.0240.00714.68
7.3.10.0200.00614.92
7.3.00.0150.00614.88
7.2.330.0110.00716.63
7.2.320.0100.01316.75
7.2.310.0100.00816.46
7.2.300.0180.00316.87
7.2.290.0130.00316.59
7.2.210.0000.01414.82
7.2.200.0140.00015.18
7.2.190.0100.00514.88
7.2.180.0040.01115.09
7.2.170.0120.00215.02
7.2.160.0090.00915.16
7.2.150.0170.00815.13
7.2.140.0090.01514.95
7.2.130.0190.00415.02
7.2.120.0170.00415.13
7.2.110.0150.00815.00
7.2.100.0960.00315.13
7.2.90.0160.00915.19
7.2.80.0210.00315.16
7.2.70.0140.01014.93
7.2.60.0130.01015.17
7.2.50.0130.01015.19
7.2.40.0170.00615.19
7.2.30.0100.01414.94
7.2.20.0140.01115.18
7.2.10.0180.00415.01
7.2.00.0160.00815.25
7.1.310.0170.00714.27
7.1.300.0140.00714.06
7.1.290.0170.00714.04
7.1.280.0190.00313.69
7.1.270.0260.00413.80
7.1.260.0190.00314.17
7.1.250.0130.01013.84

preferences:
66.6 ms | 400 KiB | 5 Q