Wednesday, 29 August 2018
Subscribe to:
Post Comments (Atom)
[date]
attribute. I believe I can use array_multisort, but I'm unsure of how to proceed.$presentations
Array
(
[0] => Array
(
[date] => 20111104
[name] => Name of Presentation
)
[1] => Array
(
[date] => 20111118
[name] => sadf
)
[2] => Array
(
[date] => 20100427
[name] => older one
)
[3] => Array
(
[date] => 20101213
[name] => Another one from 2010
)
[4] => Array
(
[date] => 20110719
[name] => sdf
)
[5] => Array
(
[date] => 20110614
[name] => Sixth one
)
)
usort
callback should return 3 types of values, depending on the circumstances:$a
is less than $b
$b
is less than $a
$a
and $b
are equalusort($presentations, function($a, $b)
{
if($a['date'] == $b['date'])
{
return 0;
}
return $a['date'] < $b['date'] ? -1 : 1;
});
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment