I have an array called $hours, this array contains 24 other arrays each for the our of the day starting with 00
How would I add a key value pair to the hours arrays so that my end result looks lik:
You should try to use native PHP date datetime class
But if you really need to learn this,
To add a value in $hours at the index "00"
$hours['00']['key'] => $value
Where 'Key' is the key of your second node level array. By what you said I think you need a 3rd node level array.
So
$hours['00']['key'] => array('value 1','value 2');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.