Unnamed
public text v1 · immutablefunction write($fileloc, $content, $type) {
if (empty($fileloc)) {
return false;
}
if (empty($content)) {
return false;
}
if (empty($type)) {
return false;
}
if (is_writable($fileloc)) {
if (!$handle = fopen($fileloc, $type)) {
return false;
}
if (fwrite($handle, $content) === FALSE) {
return false;
}
fclose($handle);
echo "Wrote to $fileloc with type $type\n";
}
else {
return false;
}
}