<?php $dir = "c"; $ach = scandir($dir); $cnt = count($ach); for($i=0;$i<$cnt;$i++){ $ach[$i]; } echo $ach[sizeof($ach) -1]; ?>