3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_GET['sortBy'] = 'B'; function get_permalink() { return 'someurl'; } function get_terms($array) { return ['foo', 'bar', 'öle', 'can']; } function esc_html($string) { return htmlspecialchars($string, ENT_QUOTES); } function alpha_pagination() { $chars = array_fill_keys(range('A', 'Z'), false); foreach (get_terms(['taxonomy' => 'unknown', 'hide_empty' => true]) as $tax) { $chars[mb_strtoupper(mb_substr($tax, 0, 1))] = true; } ksort($chars); foreach ($chars as $char => $hasTerms) { $selected = ($_GET['sortBy'] ?? '_') === $char ? ' selected' : ''; if ($hasTerms) { printf( '<a class="button%s" href="%s?%s">%s</a>', $selected, get_permalink(), http_build_query(['sortby' => $char]), esc_html($char) ); } else { printf( '<span class="button disabled%s">%s</span>', $selected, esc_html($char) ); } echo "\n"; } } alpha_pagination();

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.80.0090.00019.36
8.3.70.0130.00316.38
8.3.60.0100.01016.59
8.3.50.0090.00616.60
8.3.40.0130.00721.61
8.3.30.0070.01522.96
8.3.20.0140.00723.64
8.3.10.0130.00723.71
8.3.00.0210.00022.96
8.2.200.0120.00018.88
8.2.190.0090.00918.29
8.2.180.0040.01116.75
8.2.170.0070.00722.96
8.2.160.0100.01022.96
8.2.150.0180.00322.96
8.2.140.0080.00822.96
8.2.130.0070.00722.96
8.2.120.0170.00322.96
8.2.110.0120.00622.96
8.2.100.0110.00422.96
8.2.90.0090.01222.96
8.2.80.0140.00622.96
8.2.70.0120.00922.96
8.2.60.0080.00822.96
8.2.50.0060.01022.96
8.2.40.0000.01522.96
8.2.30.0120.00322.96
8.2.20.0150.00422.96
8.2.10.0180.00022.96
8.2.00.0030.01322.96
8.1.290.0060.00330.84
8.1.280.0040.01125.92
8.1.270.0080.00623.85
8.1.260.0040.01123.89
8.1.250.0140.00023.82
8.1.240.0070.00722.96
8.1.230.0070.00722.96
8.1.220.0110.00322.96
8.1.210.0090.00622.96
8.1.200.0000.01622.96
8.1.190.0090.00622.96
8.1.180.0080.00822.96
8.1.170.0110.00422.96
8.1.160.0060.00922.96
8.1.150.0140.00722.96
8.1.140.0100.00722.96
8.1.130.0090.00622.96
8.1.120.0000.01522.96
8.1.110.0060.01022.96
8.1.100.0100.00622.96
8.1.90.0100.00722.96
8.1.80.0090.00922.96
8.1.70.0000.01522.96
8.1.60.0040.01122.96
8.1.50.0030.01322.96
8.1.40.0100.00722.96
8.1.30.0120.00322.96
8.1.20.0110.00722.96
8.1.10.0120.00322.96
8.1.00.0030.01322.96

preferences:
42.35 ms | 401 KiB | 5 Q