Friday, July 31, 2009

PHP Read file execution time difference

If you need to read a file into a string, you can use:

$doc = implode(file($this->attachment_file));
or
$doc = file_get_contents($this->attachment_file);

Surprisingly, the first method executes faster. I don't know why.

No comments:

Post a Comment