3v4l.org

run code in 300+ PHP versions simultaneously
<?php $haystack = "I like cats."; $needles = ['cat' => 0, 'dog' => 1]; function inefficient(string $haystack, array $needles) { $qualifiers = array_filter( $needles, fn($k) => strpos($haystack, $k) !== false, ARRAY_FILTER_USE_KEY ); if (!$qualifiers) { throw new Exception('No needles were found in the haystack'); } return current($qualifiers); } try { var_export(inefficient($haystack, $needles)); } catch (Exception $e) { echo $e->getMessage(); }

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.70.0060.01218.43
8.3.60.0070.00716.60
8.3.50.0120.00316.42
8.3.40.0070.01323.73
8.3.30.0140.01022.96
8.3.20.0090.01123.15
8.3.10.0120.00923.31
8.3.00.0080.01322.96
8.2.190.0130.00716.58
8.2.180.0110.00716.38
8.2.170.0120.00622.96
8.2.160.0140.00822.96
8.2.150.0080.01222.96
8.2.140.0140.00522.96
8.2.130.0160.00522.96
8.2.120.0140.00822.96
8.2.110.0100.01222.96
8.2.100.0110.00822.96
8.2.90.0120.00822.96
8.2.80.0110.00922.96
8.2.70.0120.00922.96
8.2.60.0080.01322.96
8.2.50.0100.01122.96
8.2.40.0090.00922.96
8.2.30.0070.01222.96
8.2.20.0140.00822.96
8.2.10.0140.00822.96
8.2.00.0070.01222.96
8.1.280.0080.00825.92
8.1.270.0100.00822.96
8.1.260.0100.00822.96
8.1.250.0090.00822.96
8.1.240.0080.01222.96
8.1.230.0120.00622.96
8.1.220.0070.01222.96
8.1.210.0100.00822.96
8.1.200.0110.00922.96
8.1.190.0080.00922.96
8.1.180.0100.01022.96
8.1.170.0130.00622.96
8.1.160.0100.01022.96
8.1.150.0100.01022.96
8.1.140.0110.00922.96
8.1.130.0090.01122.96
8.1.120.0130.00722.96
8.1.110.0080.00822.96
8.1.100.0090.00822.96
8.1.90.0110.00722.96
8.1.80.0140.00222.96
8.1.70.0090.00922.96
8.1.60.0100.00722.96
8.1.50.0150.00322.96
8.1.40.0120.00522.96
8.1.30.0060.00922.96
8.1.20.0080.00922.96
8.1.10.0100.00722.96
8.1.00.0050.00922.96

preferences:
28.32 ms | 401 KiB | 5 Q