int file_put_contents ( string $filename , mixed $data [, int $flags = 0 [, resource $context ]] )
The function returns the number of bytes that were written to the file, or FALSE on failure.
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.
Code: Select all
if (!file_put_contents($dest, $data)) {
throw new Exception('failed to create file '.$dest);
Code: Select all
if (file_put_contents($dest, $data) === false) {
throw new Exception('failed to create file '.$dest);