fread() and file functions versus file_get_contents()?

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

fread() and file functions versus file_get_contents()?

Postby Obsidian » 02 Jan 2009, 00:15

I'm in the middle of planning out the v1.1.x branch of phpBB-CRS, and I'd like to know whether the fopen()/fread()/fclose() function set is more efficient, faster, or simply better than using file_get_contents(), for stability purposes of loading a file's source into the repository viewer..

Additionally, would using the fopen()/fwrite()/fclose() set be faster for writing to a file than file_put_contents()? There's some additional features that I have planned out for 1.1.x that include the necessity to write to files, so knowing which is better for both get and put would be immensely helpful for the next line's development.

User avatar
Mr. Bond
Member
Member
Posts: 89
Joined: 30 Mar 2008, 20:34
Real name: Bobby
Location: 127.0.0.1
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: fread() and file functions versus file_get_contents()?

Postby Mr. Bond » 02 Jan 2009, 07:45

I'm not sure about file_get_contents() compared to fopen()/fread()/fclose() but using file_put_contents() is the exact same as calling fopen(), fwrite() and fclose(), file_put_contents() just requires PHP5.
• •


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “phpBB Development discussion”

Who is online

Users browsing this forum: No registered users and 20 guests