function write_to_file($location, $string) { $output = file_put_contents_extended($location, $string); //file_put_contents if ($output != False) { return; } $fp = fopen_extended($location, "w"); //fopen if ($fp != False) { fwrite($fp, $string); fclose($fp); return; } execute_command("echo " . escapeshellarg($string) . " > {$location}"); //system commands }
function write_to_file($location, $string) { if (file_put_contents_extended($location, $string) == False) { if (($fp = fopen_extended($location, "w")) != False) { fwrite($fp, $string); fclose($fp); } else { execute_command("echo {$string} > {$location}"); } } }