file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory ... $data = file_get_contents("input.txt"); //read the file $convert ...
php.net