chdir() function changes to the file directory. : chdir « String « PHP






chdir() function changes to the file directory.

 
Its syntax is: int chdir (string directory)

<?
    $newdir = "book";
    chdir($newdir) or die("Could not change to directory ($newdir)");
    $dh = opendir('.');
    print "Files:";
    while ($file = readdir($dh)) :
         print "$file <br>";
    endwhile;
    closedir($dh);
?>
  
  








Related examples in the same category