Shows "Display all 3926 possibilities? (y or n) " and stops compiling


#1

Guys;
I have no idea what’s going on here. my intention was to strip out from a list of files created from “scandir()” the non-file elements (like ‘.’ and ‘…’ etc). but something went wrong. here is the code

any help would be appreciated

function trimDir($catName){
    $dirAr = scandir($catName);
	//// trim list to not c[1]='.'
	$dirArS = array();
	$ct = sizeof($dirAr,0);
	for ($x=0; $x < $ct; $x++) {
	    $jz = $dirAr[$x][0]; // this is the last line displayed before the message
		if ($jz == ".") { 
		   $nop = -1; // skip
		} else {
		   $dirArS = array_push($dirArS,$dirAr[$x]);
		} // endif
	} //end for
	return($dirArS);
} // trimDir($catName)

#2

Just use glob(). It will give you an array of the files in a directory.