007_variation1.phpt [plain text]
--TEST--
Test fopen and fclose() functions - usage variations - "r" mode
--FILE--
<?php
$file_path = dirname(__FILE__);
require($file_path."/file.inc");
create_files($file_path, 1, "text_with_new_line", 0755, 20, "w", "007_variation", 1, "bytes");
$file = $file_path."/007_variation1.tmp";
$string = "abcdefghij\nmnopqrst\tuvwxyz\n0123456789";
echo "*** Test fopen() & fclose() functions: with 'r' mode ***\n";
$file_handle = fopen($file, "r"); var_dump($file_handle); var_dump( get_resource_type($file_handle) ); var_dump( ftell($file_handle) ); var_dump( fread($file_handle, 100) ); var_dump( fwrite($file_handle, $string) ); var_dump( fclose($file_handle) ); var_dump( get_resource_type($file_handle) ); echo "*** Done ***\n";
--CLEAN--
<?php
unlink(dirname(__FILE__)."/007_variation1.tmp");
?>
--EXPECTF--
*** Test fopen() & fclose() functions: with 'r' mode ***
resource(%d) of type (stream)
string(6) "stream"
int(0)
string(20) "line
line of text
li"
int(0)
bool(true)
string(7) "Unknown"
*** Done ***