title: Get the last part of a URL from a Youtube embed code
body: <p>I woud like to get the last part of a Youtube URL from an embed code such as:</p>
  
  <pre><code>&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/gaDa2Zgtqo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>The part I am trying to get is <code>gaDa2Zgtqo</code></p>
  
  <p>I have tried using the explode e.g.</p>
  
  <pre><code>$string = '&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/gaDa2Zgtqo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;'
  $exploded = explode('/', $string);
  echo $exploded[2]
  </code></pre>
  
  <p>but this results in <code>www.youtube.com</code> and nothing else.</p>
  
  <p>Is there another approach I can use?</p>