Jump to content

get variables from string url


jwk811

Recommended Posts


<?php

$url="http://www.youtube.com/watch?v=gUPduAbJpsU&videos=HsyjHLxVbwo&playnext_from=TL&playnext=1";

preg_match("/[v]\=[a-zA-Z]{0,20}/",$url,$match);

print_R($match);
?>

 

readable way


<?php

$url="http://www.youtube.com/watch?v=gUPduAbJpsU&videos=HsyjHLxVbwo&playnext_from=TL&playnext=1";

preg_match("/[v]\=[a-zA-Z]{0,20}/",$url,$match);

$result=implode(' ',$match);

echo $result;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.