-1

I have 100 workers. I am writing workload data in file, but I don't want the size of a file to be greater than XMB, so I usee filesize to check the size of file.

Is there any performance degrade of server while using php filesize() function?

I m using below logic to check

if (filesize($file) > 20MB){
    echo "create new file and write data in that file";
}
Krzysztof Janiszewski
  • 3,763
  • 3
  • 18
  • 38
kamal kishore
  • 84
  • 1
  • 8
  • You could be just benchmarking on your own to see the performance.... the only info from the docs is _Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB._ – B001ᛦ May 23 '18 at 10:56

1 Answers1

0

According to php documentation about filesize()

Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.

So if you know fo sure that files will be smaller than 2GB than it is not a problem. If not you should try something different.

Here is a solution for bigger files.

Krzysztof Janiszewski
  • 3,763
  • 3
  • 18
  • 38