View Single Post
Old 03-19-2009, 02:30 AM   #3 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Krik View Post
Soemthing like this may help
PHP Code:
<?php
function WritetoFile($file$content) {
    
$fp fopen($file'w');
    
fwrite($fp$content);
    
fclose($fp);
}

$newcontent 'The new content for myfile.txt';
WritetoFile('myfile.txt'$newcontent);
?>

Thanks Krik, I will give that a shot....

My program is about 1000 lines long. Towards the end is where I use the shell_exec...

It is all procedural, no OOP at all....

So can I create the function on the top of the program and use the WritetoFile() function anywhere in the script?
allworknoplay is offline  
Reply With Quote