fork download
  1. <?php
  2.  
  3. //caso original com 2 ?
  4. $string = '<li><a title="string" href="http://g...content-available-to-author-only...g.com/?v=123?t=abc">Opção 1</a></li>';
  5.  
  6.  
  7. $pices = explode("?", $string);
  8.  
  9. echo str_replace("v=","",$pices[1]);
  10.  
  11. echo PHP_EOL;
  12.  
  13. //caso corrigido &
  14.  
  15. $string = '<li><a title="string" href="http://g...content-available-to-author-only...g.com/?v=123?&=abc">Opção 1</a></li>';
  16.  
  17.  
  18. $partes1 = explode("?", $string);
  19.  
  20. $partes2 = explode("&", $partes1[1]);
  21.  
  22. echo str_replace("v=","",$partes2[0]);
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
123
123