1--TEST-- 2fwrite() tests 3--FILE-- 4<?php 5 6$filename = dirname(__FILE__)."/fwrite.dat"; 7 8$fp = fopen($filename, "w"); 9var_dump(fwrite($fp)); 10var_dump(fwrite($fp, array())); 11fclose($fp); 12 13$fp = fopen($filename, "r"); 14var_dump(fwrite($fp, "data")); 15 16$fp = fopen($filename, "w"); 17var_dump(fwrite($fp, "data", -1)); 18var_dump(fwrite($fp, "data", 100000)); 19fclose($fp); 20 21var_dump(fwrite($fp, "data", -1)); 22 23var_dump(fwrite(array(), "data", -1)); 24var_dump(fwrite(array(), "data")); 25var_dump(fwrite(array())); 26 27var_dump(file_get_contents($filename)); 28 29@unlink($filename); 30echo "Done\n"; 31?> 32--EXPECTF-- 33Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d 34bool(false) 35 36Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d 37bool(false) 38int(0) 39int(0) 40int(4) 41int(0) 42 43Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d 44bool(false) 45 46Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d 47bool(false) 48 49Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d 50bool(false) 51string(4) "data" 52Done 53