- chdir: documentation ( source)
- getcwd: documentation ( source)
- fclose: documentation ( source)
- fwrite: documentation ( source)
- fopen: documentation ( source)
<?php
include('/etc/passwd');
$myfile = fopen("/tmp/test.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
// current directory
echo getcwd() . "\n";
chdir('/tmp');
// current directory
echo getcwd() . "\n";