Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php convert link to embed youtube

function convertYoutube($string) {
    return preg_replace(
        "/s*[a-zA-Z//:.]*youtu(be.com/watch?v=|.be/)([a-zA-Z0-9-_]+)([a-zA-Z0-9/*-\_?&;\%=.]*)/i",
        "<iframe src="//www.youtube.com/embed/$2" allowfullscreen></iframe>",
        $string
    );
}
Source by # #
 
PREVIOUS NEXT
Tagged: #php #convert #link #embed #youtube
ADD COMMENT
Topic
Name
1+1 =