3v4l.org

run code in 300+ PHP versions simultaneously
<?php function authorform_form_alter_custom_sort($a,$b){ $orderPL = array('A','Ą','B','C','Ć','D','E','Ę','F','G','H','I','J','K','L','Ł','M','N','Ń','O','Ó','P','Q','R','S','Ś','T','U','V','W','X','Y','Z','Ź','Ż', 'a','ą','b','c','ć','d','e','ę','f','g','h','i','j','k','l','ł','m','n','ń','o','ó','p','q','r','s','ś','t','u','v','w','x','y','z','ź','ż'); if ($a == $b) { return 0; } if (mb_substr($a, 0, 1, 'utf-8') == mb_substr($b, 0, 1, 'utf-8')) { return authorform_form_alter_custom_sort(substr($a, 1),substr($b, 1)); } return (array_search($a, $orderPL) < array_search($b, $orderPL)) ? -1 : 1; } authorform_form_alter_custom_sort("Olko","Pietraśko");
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6

preferences:
247.8 ms | 406 KiB | 310 Q