src/Kunstmaan/GeneratorBundle/Helper/GeneratorUtils.php
public static function append($string, $filename)
    {
        $context = stream_context_create();
        $fp = fopen($filename, 'r', 1, $context);
        $tmpname = md5($string);
        file_put_contents($tmpname, $fp);
        file_put_contents($tmpname, $string, FILE_APPEND);
        fclose($fp);
        unlink($filename);
        rename($tmpname, $filename);
    }
public static function append($string, $filename)
    {
        $context = stream_context_create();
        $fp = fopen($filename, 'r', 1, $context);
        $tmpname = md5($string);
        file_put_contents($tmpname, $fp);
        file_put_contents($tmpname, $string, FILE_APPEND);
        fclose($fp);
        unlink($filename);
        rename($tmpname, $filename);
    }
public static function append ( $ string , $ filename ) { $ context = stream_context_create ( ) ; $ fp = fopen ( $ filename , 'r' , 1 , $ context ) ; $ tmpname = md5 ( $ string ) ; file_put_contents ( $ tmpname , $ fp ) ; file_put_contents ( $ tmpname , $ string , FILE_APPEND ) ; fclose ( $ fp ) ; unlink ( $ filename ) ; rename ( $ tmpname , $ filename ) ; }
Append the string in the file

@param string $string   Text to be added in front of the file
@param string $filename File to prepend in
Append the string in the file