Jump to content

[SOLVED] fread or file_get_contents ?


kid85

Recommended Posts

I'm using PHP5.2.4 and don't know which of the 2 methods is better or more standard. Any other suggestions would be great.

 

I just need to open a file which is inside my server and search for 1 string using preg_match regex. I would need to read all of its contents no need to write anything.

 

 

$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));

// do regex stuff

fclose($handle);

Link to comment
https://forums.phpfreaks.com/topic/83645-solved-fread-or-file_get_contents/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.