How do I sort a multidimensional hash array by a key maybe three levels in, in PHP?

Posted by Chris Denman on Stack Overflow See other posts from Stack Overflow or by Chris Denman
Published on 2010-04-14T15:07:25Z Indexed on 2010/04/14 15:13 UTC
Read the original article Hit count: 437

Filed under:
|
|

I am moving from Perl to PHP and am struggling to get my head around PHP sorting.

Here's what I have in Perl:

$log{12345}{0}{20100102}{name}='blah';
$log{54312}{1}{20100101}{name}='blah';
$log{14323}{3}{20100103}{name}='blah';

foreach $entry (sort {$log{$cook}{$a}{time} cmp $log{$cook}{$b}{time}} keys %{$log{$cook}}){
       ...
       }

Basically, I would have the same array structure in PHP but want to sort like I do above.

© Stack Overflow or respective owner

Related posts about perl

Related posts about php