1--TEST--
2Test file_put_contents() function : variation - test append flag
3--CREDITS--
4Dave 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
13echo "*** 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
20var_dump(file_put_contents($filename, $data));
21var_dump(file_put_contents($filename, $extra, FILE_APPEND));
22echo filesize($filename)."\n";
23readfile($filename);
24echo "\n";
25clearstatcache();
26file_put_contents($filename, $data);
27echo filesize($filename)."\n";
28readfile($filename);
29echo "\n";
30unlink($filename);
31
32
33?>
34===DONE===
35--EXPECT--
36*** Testing file_put_contents() : variation ***
37int(25)
38int(18)
3943
40The first string to write, followed by this
4125
42The first string to write
43===DONE===
44