Reputation: 10430
This is my var_dump();
string(244) "a:3:{s:3:"url";s:81:"http://rsl.local/wp-content/uploads/wp-user-manager-uploads/2018/03/time-icon.png";s:4:"path";s:101:"/Users/aaronsummers/Sites/rsl-awards/wp-content/uploads/wp-user-manager-uploads/2018/03/time-icon.png";s:4:"size";i:1342;}"
How can i grab the url section?
"http://rsl.local/wp-content/uploads/wp-user-manager-uploads/2018/03/time-icon.png"
(without the quotes)
Upvotes: 1
Views: 61
Reputation: 321
Use PHP unserialize
to get the url.
$url = unserialize($str);
http://php.net/manual/en/function.unserialize.php
Upvotes: 1
Reputation: 53563
This is a serialized string. Just unserialize it, and then dereference the 'url' key:
$url = unserialize($str)['url'];
Upvotes: 3
Reputation: 1823
This is a serialized PHP array, so a simple unserialize
on that string should give you an array back on which you can just access the url key:
$array = unserialize($yourString);
echo $array['url'];
Upvotes: 5