note 58301 deleted from function.opendir by cmb

From: Date: Tue, 11 Jun 2019 06:43:00 +0000
Subject: note 58301 deleted from function.opendir by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211230@lists.php.net to get a copy of this message
Note Submitter: oryan at zareste dot com ---- There's a simpler faster way to get a whole directory if you're using PHP 4. This function uses shell_exec - http://us3.php.net/shell_exec - and assumes you're using Unix/Linux and have shell access - function dir($directory){ $files=shell_exec("ls ".$directory); return explode("\n",$files); } This returns an array with all the files. This way, you can use modifiers like -t, which shows files in order of modification time ($files=shell_exec("ls -t ".$directory);). Enough tweaking and you can use it on Windows, though I can't say how since I don't have a Windows server to try it on

« previous php.notes (#211230) next »