3 if (!defined('PHP_TEXT_CACHE_INCLUDE_PATH')) {
4 define('PHP_TEXT_CACHE_INCLUDE_PATH', (dirname(__FILE__
) . "/"));
7 class php_file_utilities
{
9 * Retrieves binary or text data from the specified file
10 * @param string The file path
11 * @param string The attributes for the read operation ('r' or 'rb')
12 * @return mixed he text or binary data contained in the file
14 function &getDataFromFile($filename, $readAttributes, $readSize = 8192) {
16 $fileHandle = @fopen
($filename, $readAttributes);
20 $data = fread($fileHandle, $readSize);
22 if (strlen($data) == 0) {
26 $fileContents .= $data;
36 * Writes the specified binary or text data to a file
37 * @param string The file path
38 * @param mixed The data to be written
39 * @param string The attributes for the write operation ('w' or 'wb')
41 function putDataToFile($fileName, &$data, $writeAttributes) {
42 $fileHandle = @fopen
($fileName, $writeAttributes);
44 fwrite($fileHandle, $data);
48 } //php_file_utilities