sort() compares by size before quality.
Because all of your rows have the same flat structure, sort() will sort ascending by row size, sort ascending by first elements, then the next elements, etc.
Code: (Demo)
$parent[0] = array(0, 0, 0);
$parent[2] = array("foo", "bar", "b", "a", "z");
$parent[1] = array(4, 2);
$parent[5] = array(11, 2);
$parent[3] = array(1, 21);
$parent[4] = array(11, 1);
sort($parent);
var_export($parent);
Output:
array (
0 =>
array (
0 => 1,
1 => 21,
),
1 =>
array (
0 => 4,
1 => 2,
),
2 =>
array (
0 => 11,
1 => 1,
),
3 =>
array (
0 => 11,
1 => 2,
),
4 =>
array (
0 => 0,
1 => 0,
2 => 0,
),
5 =>
array (
0 => 'foo',
1 => 'bar',
2 => 'b',
3 => 'a',
4 => 'z',
),
)
This performs identically to this use of array_multisort() with iterated calls of count: (Demo)
array_multisort(array_map('count', $parent), $parent);
var_export($parent);
Using usort() is different if only sorting on the counts because in modern PHP it will leave tied comparisons in their original position : (Demo)
usort($parent, fn($a, $b) => count($a) <=> count($b));
var_export($parent);