CHAPTER 15 - Testing the Extension

26 views

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);
?>



« CHAPTER 15 - Macros Used to Access zval Values CHAPTER 15 - Global Variables »
Posted on Thursday, June 7th, 2007 at 1:14 pm under PHP 5 Power Programming | RSS 2.0 Feed

Post Comment

You must be logged in to post a comment.



ComputerEducationWorld.com All Rights Reserved © RSS | CBSE | Education Boards Of India | What is My IP?