Please see the comments. I realized that the question(s) I should be asking are in another place altogether in my case, perhaps that'll be useful to you.
I am trying to optimize my cod a bit and at first, I am generating an array of strings: [String1, String3, String2] from an object. Problem is, I do it like this:
$collection = [...];
$strings = array_map(
function( $item ) {
return $item->getName();
},
$collection
);
natsort( $strings )
Is there no way to do the sorting as I loop using array_map? This is hogging performance when combined with other things.