Re: [PHP] adding numbers to a file

2002-04-22 Thread Rasmus Lerdorf
$lines = file('filename'); foreach($lines as line) { list($var,$val) = explode('=>',$line); if(trim($var)=="'total'") $val = trim($val); } $val = $new_value; $fp = fopen('filename','w'); fputs($fp,"{\n'total' => $new_value\n}"); fclose($fp); -Rasmus On

[PHP] adding numbers to a file

2002-04-22 Thread Craig Westerman
I have a simple count file named count_db that contains ONLY the following: { 'total' => 3954 } How do I open file, find numbers in the file, add $newnumbers to existing numbers. Then write these new numbers over the original numbers and close the file. I'm just needing to do this once a day