0

Hi friends am trying to get the 11 characters after the first occurance of '=' symbol for example https://www.youtube.com/watch?v=1rJs5G6j2ZY&t=1s In this link I want to extract the videoid as there 2 '=' how can I extract it .

sravya naidu
  • 39
  • 1
  • 8

1 Answers1

1
$url = "https://www.youtube.com/watch?v=1rJs5G6j2ZY&t=1s";
parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );
echo $my_array_of_vars['v'];
//Output:1rJs5G6j2ZY
Nawin
  • 1,653
  • 2
  • 14
  • 23