fwrite () returns the number of bytes written, or FALSE on error.
Check if fwrite () returns false and you will know that the write was successful. Be careful when using the comparison operator ===instead of the operator ==when checking if the return value is false.
You can use filemtime()to get the latest file modification time.
source
share