I have the following array (hence the order, it is not exactly incremental)
array ( 4334 => '4334',
4335 => '4335',
4333 => '4333',
4338 => '4338',
)
And this array
array (
'alpha' => array ( 4333 => '4333', 'objects' => array ( ), ),
'bar' => array ( 4338 => '4338', 'objects' => array ( ), ),
'charlie' => array ( 4334 => '4334', 'objects' => array ( ),
'delta' => array ( 4335 => '4335', 'objects' => array ( ), ), ),
)
As we can see, the second array contains 4 arrays. Inside there is an id again, e.g. alpha has 4333. How can I sort the second array, whereas the order is the same as the first plain array by id?
The final ordering should be:
array (
'charlie' => array ( 4334 => '4334', 'objects' => array ( ),
'delta' => array ( 4335 => '4335', 'objects' => array ( ), ), ),
'alpha' => array ( 4333 => '4333', 'objects' => array ( ), ),
'bar' => array ( 4338 => '4338', 'objects' => array ( ), ),
)