String replace for array not working
Posted: Fri Mar 31, 2006 7:44 pm
Does anyone have an idea as to why this is not working? It is not doing the string replace at all.. Thank You!
Code: Select all
<?
function MakeDirData ($CategoryName, $DirectoryName)
{
//Will be inlucded in index.php
$includes = "<?php include('../../Global.php')?>";
//Replace characters with a blank space
$spacereplace = array("*","?",":",",","'",'"',")","(","#","@","%",".");
str_replace($spacereplace, "", $DirectoryName);
str_replace($spacereplace, "", $CategoryName);
//Replace characters with a dash
$dashreplace = array("/","&","");
str_replace($dashreplace, "-", $DirectoryName);
str_replace($dashreplace, "-", $CategoryName);
//Creates the actual directories
mkdir("$CategoryName/$DirectoryName", 0777);
//Creates index and writes includes
$createIndex = fopen("$CategoryName/$DirectoryName/index.php", "w") or die("can't open file");
fwrite($CreateIndex,$includes);
}
?>