Return to file_put_contents_variation1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test file_put_contents() function : variation - test append flag 3: --CREDITS-- 4: Dave Kelsey <d_kelsey@uk.ibm.com> 5: --FILE-- 6: <?php 7: /* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]]) 8: * Description: Write/Create a file with contents data and return the number of bytes written 9: * Source code: ext/standard/file.c 10: * Alias to functions: 11: */ 12: 13: echo "*** Testing file_put_contents() : variation ***\n"; 14: 15: $filename = "FilePutContentsVar1.tmp"; 16: 17: $data = "The first string to write"; 18: $extra = ", followed by this"; 19: 20: var_dump(file_put_contents($filename, $data)); 21: var_dump(file_put_contents($filename, $extra, FILE_APPEND)); 22: echo filesize($filename)."\n"; 23: readfile($filename); 24: echo "\n"; 25: clearstatcache(); 26: file_put_contents($filename, $data); 27: echo filesize($filename)."\n"; 28: readfile($filename); 29: echo "\n"; 30: unlink($filename); 31: 32: 33: ?> 34: ===DONE=== 35: --EXPECTF-- 36: *** Testing file_put_contents() : variation *** 37: int(25) 38: int(18) 39: 43 40: The first string to write, followed by this 41: 25 42: The first string to write 43: ===DONE===