This should work, if I have understood your question correctly:
function cmp($a, $b)
{
if ($a['rank'] == $b['rank']) {
return 0;
}
return ($a['rank'] < $b['rank']) ? -1 : 1;
}
foreach($yourArray as &$entry) {
uasort($entry['stamps'], "cmp");
}
unset($entry);
print_r($yourArray);
Note that the cmp function is almost the same as in the manual. The ampersand in the foreach means that the variable created is an alias of the array member instead of a copy (as PHP usually does). The unset() is there because if you try to use a variable named $entry later, you will actually be manipulating the last entry in the array.
If you are not comfortable with this, there are other ways to skin it; for example, you could create a second function and array_map it to your original, thus:
function cmp($a, $b)
{
if ($a['rank'] == $b['rank']) {
return 0;
}
return ($a['rank'] < $b['rank']) ? -1 : 1;
}
function sort_entry($entry)
{
uasort($entry['stamps'], "cmp");
return $entry;
}
array_map('sort_entry', $yourArray);
print_r($yourArray);