Reputation: 1264
I have a field value in a mySQL table that I save into a variable called "$mp3".
If I echo this variable, I get this:
a:3:{s:4:"file";s:114:"/home/www/xxxxx/web/admin/wp-content/uploads/2014/05/table3_podcast_20141.mp3";s:3:"url";s:92:"http://www.xxxx.com/admin/wp-content/uploads/2014/05/table3_podcast_20141.mp3";s:5:"error";b:0;}
How should I complete my variable in order to only retrieve this part of the array (whatever its content):
http://www.xxxx.com/admin/wp-content/uploads/2014/05/table3_podcast_20141.mp3
Thank you!
Upvotes: 0
Views: 51
Reputation: 3413
That value is a serialized storage of a PHP array.
To reconstruct the array you need to use unserialize:
$data = unserialize($mp3);
$url = $mp3['url'];
Upvotes: 1