-4

I am getting an error during my execution of the code:

PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\apache2triad\htdocs\imagedisplay.php on line 28

<?php

$dir= "C:\apache2triad\htdocs\phppgadmin\images\phpimages";

$file_display= array('jpg', 'jpeg', 'png', 'gif');

if(file_exists($dir)== false) 
{
  echo "directory x not found";
}
else
{
  $dir_content= scandir($dir);

  foreach($dir_content as $file)
  {
    $file_type = strtolower(end(explode('.', $file)));
     
    // echo "$file <br> ";

    if($file !=='.' && $file !=='..')
    {
      //echo "$file <br> ";   
      echo "<img src="', $dir, '/', $file, '" alt="', $file, '"/>";
    }      
  }   
}
?>
Dharman
  • 30,962
  • 25
  • 85
  • 135
ishu
  • 9
  • 1
  • 2

1 Answers1

3
echo "<img src="', $dir, '/', $file, '" alt="', $file, '"/>";
               ^^-- here

You've essentially got two different strings back-to-back here, making this line completely invalid.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • then what is to be done to make it work – ishu May 20 '12 at 14:37
  • Start by learning basic PHP syntax rules. We can tell you the solution, but then you learn nothing and continue to make the same error elsewhere. – Marc B May 20 '12 at 20:44