Directory search snippet problem

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Directory search snippet problem

Post by DarkRanger »

Hi hi,

CAn anyone tell me why this piece of code doesn't work?

Code: Select all

<?php
	function readDirs($main){
		$dirHandle = opendir($main);
		while($file = readdir($dirHandle)){
		if(is_dir($file) && $file != '.' && $file != '..'){
			   readDirs($file);
			}
			else{
			  echo $file . '<br/>';
			}
		} 
	}
	
	$dir = '../../lib';
	
	readDirs($dir);
?>
It must show all the files in the directory, but only shows:

Code: Select all

.
..
technical
Image
Post Reply