как получить идентификатор видео из iframe из youtube в php или cakephp

У меня этот iframe

<iframe width="425" height="349" src="http://www.youtube.com/embed/YRUG-Pu7RzE" frameborder="0" allowfullscreen></iframe> 

как получить идентификатор видео с помощью регулярного выражения или любого …..

Вы можете использовать:

 $subject = '<iframe width=\"425\" height=\"349\" src=\"http://www.youtube.com/embed/YRUG-Pu7RzE\" frameborder=\"0\" allowfullscreen></iframe>'; $pattern = '!http://(?:www.)?youtube.com/embed/([^"']+)!i'; $result = preg_match($pattern, $subject, $subpattern); 

$ subpattern будет содержать:

 Array ( [0] => http://www.youtube.com/embed/YRUG-Pu7RzE [1] => YRUG-Pu7RzE )