title: php embeded javascript parse error php tags causing "syntax error: expected expression, got <"
body: <p>there is a failure of my php script to parse. The Mozilla error console gives me syntax error: expected expression, got &lt; can anyone tell me what is wrong with my script. any help is much appreciated.</p>
  
  <p>thankyou</p>
  
  <pre><code>&lt;?php  
  Header("content-type: application/x-javascript");
  
  function returnimages($dirname=".") {
  $pattern="\.(jpg|jpeg|png|gif|bmp)$";
  $files = array();
  $curimage=0;
  if($handle = opendir($dirname)) {
  while(false !== ($file = readdir($handle))){
  if(eregi($pattern, $file)){
  echo 'galleryarray[' . $curimage .']=["' . $file . '"];' . "\n";
  $curimage++;
  }
  }
  
  closedir($handle);
  }
  return($files);
  }
  
  echo "var galleryarray=new Array();" . "\n";
  returnimages();
  ?&gt;
  </code></pre>