Home  >  Article  >  Backend Development  >  Ministry of Human Resources and Social Security Document No. 10774 Reading Efficiency of PHP Text File

Ministry of Human Resources and Social Security Document No. 10774 Reading Efficiency of PHP Text File

WBOY
WBOYOriginal
2016-07-29 08:48:011398browse

The homepage is about 3KB and was tested locally.

Copy the code The code is as follows:


file_get_contents('shadow.


$indexFile = fopen('shadow.xml', 'r');while ( !feof($indexFile)) fgetc( $indexFile);

Take 0.026 seconds

Copy code


Code As follows:


$indexFile = fopen('shadow.xml', 'r');fread($indexFile, 10000);

It takes 0.0003 secondsThe difference is nearly 100 times! ! It’s really unexpected I guess all the time is wasted on the while loop or something. The above introduces the reading efficiency of the Ministry of Human Resources and Social Security Document No. 10774 PHP text file, including the content of the Ministry of Human Resources and Social Security Document No. 10774. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn