Writing Array To File
Posted: Mon Aug 17, 2009 2:36 pm
Hello fellow developers...i was wondering if i could get some of your insight into this problem i appear to be having
I need to know how to save an array into a .txt document as i cannot figure out how to do it.
Here is what i have so far:
What i would like to do now is save is the array domainarray into a text document, which contains all of the domain names which it needs, but i am not 100% certain of how to do that
Does anyone have any ideas?
Thank you ^.^
~Daniel
I need to know how to save an array into a .txt document as i cannot figure out how to do it.
Here is what i have so far:
Code: Select all
<?php
//Hold server IP
$ip_hold = $_SERVER['SERVER_ADDR'];
$ip_write = "The IP of the server that send this log is ".$ip_hold."";
//Open www directory
$dir = opendir("../../");
$count = 0;
$count2 = 0;
//Put all folders into an array
while (($file = readdir($dir)) !== false)
{
$files[$count]=$file;
$count++;
}
closedir($dir);
while ($count2 != $count)
{
$temp = $files[$count2];
$direc = "../../$temp";
if(is_dir($direc))
{
$filename = "../../$temp/pubstermx/inc/pubsterdomainconfig.php";
if (file_exists($filename))
{
require $filename;
$domaincount++;
$domainarray[$domaincount] = $DOMAIN_NAME;
echo "$domaincount ";
}
$count2++;
}
}
?>Does anyone have any ideas?
Thank you ^.^
~Daniel