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) { printf( '<%1$s class="button%2$s%3$s">%4$s</%1$s>' . "\n", $hasTerms ? 'a' : 'span', // %1$s ($_GET['sortBy'] ?? '_') === $char ? ' selected' : '', // %2$s $hasTerms ? '" href="' . get_permalink() . '?' . http_build_query(['sortby' => $char]) : ' disable', // %3$s esc_html($char) // %4$s ); } } 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.4.120.0080.01224.03
8.4.110.0100.01019.01
8.4.100.0120.00818.95
8.4.90.0130.00620.80
8.4.80.0150.00618.85
8.4.70.0040.00618.85
8.4.60.0100.01019.15
8.4.50.0130.00720.35
8.4.40.0100.01017.86
8.4.30.0100.01018.72
8.4.20.0070.01417.83
8.4.10.0130.00619.45
8.3.250.0030.00518.56
8.3.240.0120.00717.34
8.3.230.0100.00916.91
8.3.220.0040.00419.16
8.3.210.0100.00818.48
8.3.200.0110.00816.94
8.3.190.0130.00617.29
8.3.180.0140.00516.53
8.3.170.0070.00018.91
8.3.160.0130.00617.40
8.3.150.0100.01017.01
8.3.140.0040.01116.66
8.3.130.0100.00718.33
8.3.120.0030.00620.82
8.3.110.0050.00520.94
8.3.100.0060.00318.53
8.3.90.0140.00016.53
8.3.80.0090.00018.30
8.3.70.0120.00316.75
8.3.60.0110.00816.56
8.3.50.0120.00416.79
8.3.40.0000.01522.03
8.3.30.0130.00722.96
8.3.20.0040.01523.64
8.3.10.0090.00923.70
8.3.00.0070.01022.96
8.2.290.0080.00820.64
8.2.280.0120.00818.54
8.2.270.0120.00619.40
8.2.260.0000.00816.62
8.2.250.0070.01016.93
8.2.240.0090.00017.59
8.2.230.0040.00422.58
8.2.220.0040.00424.06
8.2.210.0030.00726.77
8.2.200.0090.00416.50
8.2.190.0110.00718.54
8.2.180.0100.00616.88
8.2.170.0150.00022.96
8.2.160.0100.01022.96
8.2.150.0100.01022.96
8.2.140.0150.00322.96
8.2.130.0070.00722.96
8.2.120.0100.00322.96
8.2.110.0030.01022.96
8.2.100.0040.01122.96
8.2.90.0160.00322.96
8.2.80.0090.00622.96
8.2.70.0070.00722.96
8.2.60.0140.00722.96
8.2.50.0100.01022.96
8.2.40.0090.00622.96
8.2.30.0110.00722.96
8.2.20.0100.00722.96
8.2.10.0110.00422.96
8.2.00.0110.00422.96
8.1.330.0110.00522.07
8.1.320.0110.00816.31
8.1.310.0140.00318.64
8.1.300.0060.00320.15
8.1.290.0070.00318.88
8.1.280.0150.00325.92
8.1.270.0120.00322.96
8.1.260.0110.00322.96
8.1.250.0030.01022.96
8.1.240.0040.01122.96
8.1.230.0040.01122.96
8.1.220.0040.01122.96
8.1.210.0120.00322.96
8.1.200.0080.00622.96
8.1.190.0110.00322.96
8.1.180.0140.00022.96
8.1.170.0070.00722.96
8.1.160.0040.01122.96
8.1.150.0040.01122.96
8.1.140.0000.01522.96
8.1.130.0110.00422.96
8.1.120.0150.00022.96
8.1.110.0160.00022.96
8.1.100.0120.00322.96
8.1.90.0060.01022.96
8.1.80.0070.00722.96
8.1.70.0110.00422.96
8.1.60.0090.00622.96
8.1.50.0060.00922.96
8.1.40.0060.00922.96
8.1.30.0070.01022.96
8.1.20.0140.00422.96
8.1.10.0060.01222.96
8.1.00.0150.00422.96

preferences:
29.22 ms | 403 KiB | 5 Q