views:

57

answers:

0

how do I do this.

the file can get very big, so good performance is necessary

code is helpful.

this is what i have so far

function prepend($string, $filename) { 
    $context = stream_context_create (); 
    $fp = fopen($filename,'r',1,$context); 
    $tmpname = md5($string); 
    file_put_contents($tmpname,$string); 
    file_put_contents($tmpname,$fp,FILE_APPEND); 
    fclose($fp); 
    unlink($filename); 
    rename($tmpname,$filename); 
} 

thanks in advance

regards

Jer