You are now ready to write a test script to
check that the extension works. Here’s a sample script that opens a file
test.txt, prints its contents to the standard output, and creates a copy of the
file as test.txt.new:
<?php
$fp_in = file_open(”test.txt”, “r”) or die(”Unable to open input
file\n”);
$fp_out = file_open(”test.txt.new”, “w”) or die(”Unable to open
output file\n”);
while (!file_eof($fp_in)) {
$str = file_read($fp_in, 1024);
print($str);
file_write($fp_out, $str);
}
file_close($fp_in);
file_close($fp_out);
?>
