Closed piperhaywood closed 2 years ago
I could be mistaken and don't have a way to test this well but I believe that there is a sort
missing for $groups
.
I tried replicating this with the following:
<?php
function cp_add_to_index($groups, $name) {
$first_char = strtoupper($name[0]);
$groups[$first_char][uniqid()] = array();
return $groups;
}
$groups = array();
$groups = cp_add_to_index($groups, "zebra");
$groups = cp_add_to_index($groups, "alligator");
$groups = cp_add_to_index($groups, "Cat");
$groups = cp_add_to_index($groups, "Aardvark");
$groups = cp_add_to_index($groups, "lion");
$groups = cp_add_to_index($groups, "Yak");
foreach($groups as $char => $terms) {
echo $char;
}
echo "\n";
ksort($groups);
foreach($groups as $char => $terms) {
echo $char;
}
I could be missing something else or the list could be coming in sorted originally but just thought I'd share what I saw.
Thanks so much for the suggestion! I’ll take a look and try to see if that’s the case… I’m on maternity leave at the moment so it will take me a bit, but will try to look soon!
On 1 Sep 2021, at 9:53 pm, Benji Encalada Mora @.***> wrote:
I could be mistaken and don't have a way to test this well but I believe that there is a sort missing for $groups.
I tried replicating this with the following:
<?php
function cp_add_to_index($groups, $name) { $first_char = strtoupper($name[0]); $groups[$first_char][uniqid()] = array(); return $groups; }
$groups = array(); $groups = cp_add_to_index($groups, "zebra"); $groups = cp_add_to_index($groups, "alligator"); $groups = cp_add_to_index($groups, "Cat"); $groups = cp_add_to_index($groups, "Aardvark"); $groups = cp_add_to_index($groups, "lion"); $groups = cp_add_to_index($groups, "Yak");
foreach($groups as $char => $terms) { echo $char; } echo "\n";
ksort($groups); foreach($groups as $char => $terms) { echo $char; } I could be missing something else or the list could be coming in sorted originally but just thought I'd share what I saw.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
V comes after Q... WTH is that about?! Related to #35