Here's the script:
but here's the output:
We will attempt to write a file called "test.dat" and store some
stuff in it.
The file Resource id #1 should now be opened.
Now writing... 0
Now writing... 1
Now writing... 2
Now writing... 3
Now writing... 4
The file should now be closed.
Note Resource id #1
Is that right, and if so, the output file only contains DONE with no CR after it
my setup:
PHP 4.1.2
Apache 1.3.23
And Mandrake Linux 8.2
and help would be great
Code:
<html>
<title>File Write Experiment</title>
<body>
We will attempt to write a file called "test.dat" and store some
stuff in it.
<?php
$myfile = fopen("test.dat","w");
print "The file $myfile should now be opened.
";
print "<HR>";
$number=0;
while($number<5)
{
print "Now writing... $number
";
$fp = fwrite($myfile,"$number,");
$number++;
}
$fp = fwrite($myfile,$number);
$fp = fwrite($myfile,chr(13));
$fp = fwrite($myfile,"DONE");
fclose($myfile);
?>
The file should now be closed.
</body>
</html>
We will attempt to write a file called "test.dat" and store some
stuff in it.
The file Resource id #1 should now be opened.
Now writing... 0
Now writing... 1
Now writing... 2
Now writing... 3
Now writing... 4
The file should now be closed.
Note Resource id #1
Is that right, and if so, the output file only contains DONE with no CR after it
my setup:
PHP 4.1.2
Apache 1.3.23
And Mandrake Linux 8.2
and help would be great