Skip to content
Advertisement

Convert string to multidimensional array to calculate date in php

I have a string as below

JavaScript

I want to break this string to multidimensional array and store days like Mon,Tue,Wed as keys and the values inside square brackets as values for each day as below and access each day as smaller arrays

JavaScript

with this below code I was able to achieve it but the value such as [3,9] or [5,11] are being treated as strings

JavaScript

when I print $valArray it is a array like below which is very bad.

JavaScript

Please help

Advertisement

Answer

I think this is the result you were asking for.

JavaScript

Result

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement