I have the data saved using a plugin in this format:
a:7:{s:6:'Sunday ';a:3:{s:6:'active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:'end ';s:5:'13: 00 ';}
s:6:'Monday ';a:3:{s:6:'active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:' end ';s:5:'17: 00 ';}
s:7:'Tuesday ';a:3:{s:6:' active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:'end ';s:5:'17: 00 ';}
s:9:'Wednesday ';a:3:{s:6:'active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:'end ';s:5:'17: 00 ';}
s:8:'Thursday ';a:3:{s:6:'active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:'end ';s:5:'17: 00 ';}
s:6:'Friday ';a:3:{s:6:'active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:'end ';s:5:'17: 00 ';}
s:8:'Saturday ';a:3:{s:6:'active ';s:3:'yes ';s:5:'start ';s:5:'08: 00 ';s:3:'end ';s:5:'13: 00 ';}}
How can I extract this data using php or any WordPress functions?
I have already tried unserialize()
, maybe_unserialize()
json_decode
. But all I get is null in the end.
json_decode()
? – Nathan Powell Jan 30 '16 at 7:16json_encode()
but it gives me null in response. The plugin saves the data in this format in database. SO what I need to to extract this data in array to display on template. – Sachin Stellen Jan 30 '16 at 7:26