Cris Denolatter Cris Denolatter - 1 year ago 78
PHP Question

How can I parse this string? (about wordpress)

I wanna parse this code:


I wanna get the 1472256000 and 1472342400 with PHP. How can I do this?


Answer Source

That's a serialized string. So all you have to do is unserialize it.

$str = 'a:4:{s:7:"arrival";i:1472256000;s:9:"departure";i:1472342400;s:6:"adults";s:1:"1";s:9:"childrent";s:4:"None";}';

$str = unserialize($str);

echo $str['arrival'];

echo $str['departure'];