public
anonymous / gist:6462971
Created

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
$dataArray = array();
$data = array(
'Offer' => array('id' => 2, 'name' => 'ExampleName'),
'Stat' => array('Stat1' => 1, 'Stat2' => 2),
'Country' => array('Name' => array('z','name2'))
);
array_push($dataArray,$data);
$data = array(
'Offer' => array('id' => 2, 'name' => 'ExampleName'),
'Stat' => array('Stat1' => 1, 'Stat2' => 3),
'Country' => array('Name' => array('a','name2'))
);
array_push($dataArray,$data);
print_r(Set::sort($dataArray,'{n}.Country.Name','asc'));
/* Array (
[0] => Array (
[Offer] => Array (
[id] => 2
[name] => ExampleName
)
[Stat] => Array (
[Stat1] => 1
[Stat2] => 3
)
[Country] => Array (
[Name] => Array (
[0] => a
[1] => name2
)
)
)
[1] => Array (
[Offer] => Array (
[id] => 2
[name] => ExampleName
)
[Stat] => Array (
[Stat1] => 1
[Stat2] => 2
)
[Country] => Array (
[Name] => Array (
[0] => z
[1] => name2
)
)
)
)*/

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.