title: calling function inside preg_replace thats inside a function
body: <p>I have some code with the a structure similar to this</p>
  
  <pre><code>           function bbcode($Text)
             { //$Text = preg_replace("/\[video\](.+?)\[\/video\]/",embed_video($1), $Text);
      return $Text;}
  
      function embed_video($url){
  if (preg_match("/http:\/\/www.youtube.com\/watch\?v=([0-9a-zA-Z-_]*)(.*)/i", $url, $matches)) {
      return '&lt;object width="425" height="350"&gt;'.
             '&lt;param name="movie" value="http://www.youtube.com/v/'.$matches[1].'" /&gt;'.
             '&lt;param name="wmode" value="transparent" /&gt;'.
             '&lt;embed src="http://www.youtube.com/v/'.$matches[1].'&amp;autoplay="0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350" /&gt;'.
             '&lt;/object&gt;';
  }
      return $url;
      }
  
  $lolcakes = "[video]http://youtube.com/id/xxxxxxpron[/video]";
  $lolcakesconverted = bbcode($lolcakes);
  </code></pre>
  
  <p>The problem is it spits an error back at me.</p>
  
  <p>Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'</p>
  
  <p>Have any ideas on how i can call embed_video inside of the preg_replace of the bbcode function?</p>
  
  <p>Thanks!</p>