I have the following object as the result of a database query, the last part of the object $result->meta_value
is what I’m interested in.
I need to get this value from the string:
file";s:24:"2012/04/twitter.jpg";
Can anyone suggest how I could go about breaking that string down into something useful?
object(stdClass)#72 (4) {
["meta_id"]=>
string(4) "2367"
["post_id"]=>
string(3) "540"
["meta_key"]=>
string(23) "_wp_attachment_metadata"
["meta_value"]=>
string(646) "a:6:{s:5:"width";s:3:"300";s:6:"height";s:3:"180";s:14:"hwstring_small";s:23:"height='76' width='128'";s:4:"file";s:24:"2012/04/twitter.jpg";s:5:"sizes";a:2:{s:9:"thumbnail";a:3:{s:4:"file";s:24:"twitterwinjs-150x150.jpg";s:5:"width";s:3:"150";s:6:"height";s:3:"150";}s:14:"post-thumbnail";a:3:{s:4:"file";s:22:"twitter60x60.jpg";s:5:"width";s:2:"60";s:6:"height";s:2:"60";}}s:10:"image_meta";a:10:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";}}"
}
This string is an array serialized, see http://php.net/serialize.