$OldContent = file_get_contents("$filePath"); $NewContent = str_replace("/", "-", $OldContent); $NewFile = file_put_contents($filePath,$NewContent);