ereg help!

From: Date: Wed, 09 Jan 2008 01:45:10 +0000
Subject: ereg help!
Groups: php.general 
Request: Send a blank email to php-general+get-266946@lists.php.net to get a copy of this message
I have a dir of html files that link to websites, i would like to read the dir and print a list of those files as a link. Which the script i have does. I would like to take this one step further and replace the ".html" extension with ".com" so it winds up being: website.com instead of website.html I am apparently having problems getting my head around eregi enough to acomplish this. any help is greatly appreciated. <? $source_dir = "./mydir"; $dir=opendir($source_dir); $files=array(); while (($file=readdir($dir)) !== false) { if ($file != "." && $file != ".." && strpos(strtolower($file),".php") === false) { array_push($files, $file); } } closedir($dir); sort($files); foreach ($files as $file) { echo "<A href='$file'>$file<br>"; } ?>

« previous php.general (#266946) next »