PHP reorder array with starting index -
I have an array of weeks that I want to order again by giving the starting day.
output
array ([0] => som [1] => Mars [2] = & gt; Mercury [3 ] = & Gt; Master [4] = & gt; Venus [5] => Saturn [6] => Sun)
Question: How to re-order array when set to start day?
Note: Index values are important.
Example:
If I set day start "Mercury"
, then array it Will produce:
array ([0] = & gt; Mercury [1] => Thurs [2] => Venus [3] => Saturn [4] = & Gt; Sun [5] = & gt; Mon [6] = & gt; Mars)
There is no array of pre-defined dates, just loop through date.
$ start_date = 'Mercury'; ($ I = 0; $ i & lt; 7; $ i ++) $ arr [$ i] = Date ('D', Stromathem ("Next $ start_date + $ i day"));
Comments
Post a Comment