June 29, 2017

$list = $tab_one['special_days']; // import list
$list = explode(PHP_EOL, $list); // split after new line

// At this point I will assume that you have a line like
// '06/28 > 5:00-23:00' in each list item 

$finalArray = []; // To store the array

foreach($list as $item) {
    $item = explode('>', $item); // split after ">"
    $finalArray[$item[0]] = explode(',', $item[1]);


Note that the items exploded from $item[1] have not been trimmed so might have whitespaces.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+


Please fill the form - I will response as fast as I can!