3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Yes we can use special chars in identifiers! class ñßü {} $chars = ['aa', 'az', 'b', 'c', 'x', 'za', 'ä', 'ü', 'ß', 'ñ']; // Put the lowercase chars twice to identify if they have equal weight. $chars = [...$chars, ...array_map(ucfirst(...), $chars), ...$chars]; foreach ([ 'usort + strcmp' => fn (&$arr) => usort($arr, strcmp(...)), 'usort + strcasecmp' => fn (&$arr) => usort($arr, strcasecmp(...)), 'sort' => sort(...), ] as $name => $sortfunction) { $chars_sorted = $chars; $sortfunction($chars_sorted); print implode(', ', $chars_sorted) . " # $name\n"; }
Output for git.master_jit, git.master
Aa, Az, B, C, X, Za, aa, aa, az, az, b, b, c, c, x, x, za, za, ß, ß, ß, ä, ä, ä, ñ, ñ, ñ, ü, ü, ü # usort + strcmp aa, Aa, aa, az, Az, az, b, B, b, c, C, c, x, X, x, za, Za, za, ß, ß, ß, ä, ä, ä, ñ, ñ, ñ, ü, ü, ü # usort + strcasecmp Aa, Az, B, C, X, Za, aa, aa, az, az, b, b, c, c, x, x, za, za, ß, ß, ß, ä, ä, ä, ñ, ñ, ñ, ü, ü, ü # sort

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
37.15 ms | 406 KiB | 5 Q