View Single Post
Old 11-28-2008, 10:50 PM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Here it is nice and simple. You don't necessarily need to use the fopen, fwrite and fclose functions as PHP5 packages those nicely into one function for us:

php Code:
$szData = 'TalkPHP.com';
$szFolder = sprintf('./%s/', 'Wildhoney');
$szFile = sprintf('%s.txt', date('Y-m-d'));

if (!is_dir($szFolder))
{
    mkdir($szFolder);
}

file_put_contents($szFolder . $szFile, $szData);
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote