How to extract a filename from a complex string in PHP? -
i have php string contains complex structure. string:
a:10:{s:4:"type";s:9:"image/png";s:5:"title";s:19:"1394228903_imac.png";s:10:"quote_path";s:68:"/media/custom_options/quote/1/3/2b2a7355414ba6d486a4fdd2af96809e.png";s:10:"order_path";s:68:"/media/custom_options/order/1/3/2b2a7355414ba6d486a4fdd2af96809e.png";s:8:"fullpath";s:107:"/users/gabriel/documents/projects/demo4/media/custom_options/quote/1/3/2b2a7355414ba6d486a4fdd2af96809e.png";s:4:"size";s:4:"3558";s:5:"width";i:128;s:6:"height";i:128;s:10:"secret_key";s:20:"2b2a7355414ba6d486a4";s:3:"url";a:2:{s:5:"route";s:35:"sales/download/downloadcustomoption";s:6:"params";a:2:{s:2:"id";s:2:"42";s:3:"key";s:20:"2b2a7355414ba6d486a4";}}} the string stored in $fullvalue variable.
how can extract image filename there? want extract this: 2b2a7355414ba6d486a4fdd2af96809e.png
thanks.
the structure show here isn't json string. looks serialized php string.
so, should this:
$data = unserialize($input); echo basename($data["fullpath"]);
Comments
Post a Comment