Friendly Display of Store Hours from PHP Array

Viewed 31

I have an array in PHP that has store hours. Data includes day of the week, open time, and close time. I can display each day individually, but I'd like to be able to group days together where the hours are the same.

For example: Sun-Mon 11-8, Tues-Sat 11-9.

This data is coming from an API, so I can't change how I receive it. Any ideas to point me in the right direction?

[hours] => Array
(
        [Monday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 08:00pm
                                        [description] => 
                                )

                )

        [Tuesday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 09:00pm
                                        [description] => 
                                )

                )

        [Wednesday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 09:00pm
                                        [description] => 
                                )

                )

        [Thursday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 09:00pm
                                        [description] => 
                                )

                )

        [Friday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 09:00pm
                                        [description] => 
                                )

                )

        [Saturday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 09:00pm
                                        [description] => 
                                )

                )

        [Sunday] => Array
                (
                        [0] => Array
                                (
                                        [opening] => 11:00am
                                        [closing] => 08:00pm
                                        [description] => 
                                )

                )

)
0 Answers
Related