2 /* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
3 * Description: Write/Create a file with contents data and return the number of bytes written
4 * Source code: ext/standard/file.c
8 echo "*** Testing file_put_contents() : variation ***\n";
10 require_once('fopen_include_path.inc');
12 $thisTestDir = basename(__FILE__
, ".php") . ".dir";
16 $filename = basename(__FILE__
, ".php") . ".tmp";
18 $newpath = create_include_path();
19 set_include_path($newpath);
22 $newpath = generate_next_path();
23 set_include_path($newpath);
26 teardown_include_path();
27 restore_include_path();
35 //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
36 // in the include path. In this case it doesn't so the file should be written in the current dir.
38 file_put_contents($filename, (binary
) "File in include path", FILE_USE_INCLUDE_PATH
);
39 file_put_contents($filename, (binary
) ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND
);
40 $line = file_get_contents($filename);