html - How to pull out a src value and parse out a ID number with php -
im using wordpress , pass custom field through. data ends looking this, different urls sometimes:
$embed = '<iframe width="560" height="315" src="//www.youtube.com/embed/abcde12345" frameborder="0" allowfullscreen></iframe>'
i wondering how can pull src value out , how store text bolded below within url.
src="//www.youtube.com/embed/abcde12345"
i did search , saw people recommended using eval() tried reading , couldn't understand documentation.
$src = array(); preg_match('(src="//www.youtube.com/embed/(.*?)")e', $embed, $src); echo $src[1];
Comments
Post a Comment