0

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!

1
  • 2
    This is a serialized string read unserialize Commented Jun 4, 2014 at 13:49

1 Answer 1

1

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'];
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much. I'll accept this answer in a few minutes (when the system allows me to do so)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.