`file_put_contents` should not be used in an `if` directly like that; in PHP, it's best to separate checks (`if`) from actions (`file_put_contents`). His code is fine. I agree with moving the `if` check for `$success` emptiness to within the `is_writable` if however.