I'm trying to work out a way to create a multidimensional array from a previous array, and then sort it into date order.
Presently my array looks like this:
array(5) {
[0]=> string(161) "2013-09-18~Ready For Retina HD: Create Pixel-Perfect Assets For Multiple Scale Factors~ready-for-retina-hd-create-pixel-perfect-assets-for-multiple-scale-factors"
[1]=> string(93) " 2010-10-20~Taking A Closer Look At Tech Conferences~taking-a-closer-look-at-tech-conferences"
[2]=> string(71) " 2014-10-19~Wayfinding For The Mobile Web~wayfinding-for-the-mobile-web" [3]=> string(60) " 2014-05-15~Freebie: Icons Of Autumn~freebie-icons-of-autumn"
[4]=> string(1) " "
}
Each array element now needs to be further broken down by using the delimiter ~, I had previously done this using a foreach loop however this created 3 different arrays of data, not one multidimensional array.
I obviously need to name each of the values, $date, $title and $filename.
How would you do this with a foreach loop so that it stores it in one multi-dimensional array? This is what I had previously
foreach ($masterpostlist as &$post){
$post = explode('~',$post);
}
How would you then sort the date part of the array so that they order newest first?