raga devo fare una pagina nela quale automaticamente visualizzo le immagini presenti nella cartella

ho provato a cercare di capire su php.net come funzionavano le varie open dir ecc.

ma non ho cappito come devo fare .. ho anche usatogli esempi riportati ma ho un errore
codice:
<?php
// Note that !== did not exist until 4.0.0-RC2

if ($handle = opendir('/membri2/nintendolife/img/')) {
 __ echo "Directory handle: $handle \n";
 __ echo "Files: \n";

 __  /* This is the correct way to loop over the directory. */
 __  while (false !== ($file = readdir($handle))) { 
 __ _ _ echo "$file \n";
 __ }

 __  /* This is the WRONG way to loop over the directory. */
 __  while ($file = readdir($handle)) { 
 __ _ _ echo "$file \n";
 __ }

 __  closedir($handle); 
 }
?>
se uso questo codice mi dice errore al rigo 5