Skip to content

Instantly share code, notes, and snippets.

@pix-art
Last active May 30, 2016 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pix-art/ab3d74e431c6127a9c2fae16c7f3ecda to your computer and use it in GitHub Desktop.
Save pix-art/ab3d74e431c6127a9c2fae16c7f3ecda to your computer and use it in GitHub Desktop.
<?php
function writeFile($fullpath, $content)
{
if (!is_writable($fullpath)) {
return false;
}
if (!$fp = fopen($fullpath,'w')) {
return false;
}
if (!fwrite($fp,$content)) {
return false;
}
return true;
}
@yerlikayao
Copy link


function writeFile($fullpath, $content)
{
    if (!is_writable($fullpath) || !$fp = fopen($fullpath,'w')) || !fwrite($fp,$content)) {
        return false;
    }

    return true;
}

optimized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment