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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -