note 88550 added to function.readfile

From: Date: Wed, 28 Jan 2009 20:28:52 +0000
Subject: note 88550 added to function.readfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-149907@lists.php.net to get a copy of this message
Opps on the last post I made.. i missed a } Here is the correction function readfile_chunked ($filename,$type='array') { $chunk_array=array(); $chunksize = 1*(1024*1024); // how many bytes per chunk $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { switch($type) { case'array': // Returns Lines Array like file() $lines[] = fgets($handle, $chunksize); break; case'string': // Returns Lines String like file_get_contents() $lines = fread($handle, $chunksize); break; } } fclose($handle); return $lines; } ---- Server IP: 208.69.120.35 Probable Submitter: 71.125.8.10 ---- Manual Page -- http://www.php.net/manual/en/function.readfile.php Edit -- https://master.php.net/note/edit/88550 Del: integrated -- https://master.php.net/note/delete/88550/integrated Del: useless -- https://master.php.net/note/delete/88550/useless Del: bad code -- https://master.php.net/note/delete/88550/bad+code Del: spam -- https://master.php.net/note/delete/88550/spam Del: non-english -- https://master.php.net/note/delete/88550/non-english Del: in docs -- https://master.php.net/note/delete/88550/in+docs Del: other reasons-- https://master.php.net/note/delete/88550 Reject -- https://master.php.net/note/reject/88550 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149907) next »