1--TEST--
2Test file_get_contents() and file_put_contents() functions : usage variations - all arguments
3--FILE--
4<?php
5
6
7/* Testing variation in all argument values */
8$file_path = __DIR__;
9include($file_path."/file.inc");
10
11echo "*** Testing with variations in the arguments values ***\n";
12
13$buffer_types = array("text", "numeric", "text_with_new_line", "alphanumeric");
14
15foreach( $buffer_types as $type) {
16  fill_buffer($buffer, $type, 100);
17  file_put_contents( $file_path."/file_put_contents_variation1.tmp", $buffer);
18  var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0) );
19  var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1) );
20  var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0, NULL, 5) );
21  var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1, NULL, 5) );
22  var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 0, NULL, 5, 20) );
23  var_dump( file_get_contents($file_path."/file_put_contents_variation1.tmp", 1, NULL, 5, 20) );
24
25}
26
27echo "--- Done ---";
28?>
29--CLEAN--
30<?php
31//Deleting the temporary file
32
33$file_path = __DIR__;
34unlink($file_path."/file_put_contents_variation1.tmp");
35?>
36--EXPECT--
37*** Testing with variations in the arguments values ***
38string(100) "text text text text text text text text text text text text text text text text text text text text "
39string(100) "text text text text text text text text text text text text text text text text text text text text "
40string(95) "text text text text text text text text text text text text text text text text text text text "
41string(95) "text text text text text text text text text text text text text text text text text text text "
42string(20) "text text text text "
43string(20) "text text text text "
44string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
45string(100) "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
46string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
47string(95) "22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
48string(20) "22222222222222222222"
49string(20) "22222222222222222222"
50string(100) "line
51line of text
52line
53line of text
54line
55line of text
56line
57line of text
58line
59line of text
60line
61line "
62string(100) "line
63line of text
64line
65line of text
66line
67line of text
68line
69line of text
70line
71line of text
72line
73line "
74string(95) "line of text
75line
76line of text
77line
78line of text
79line
80line of text
81line
82line of text
83line
84line "
85string(95) "line of text
86line
87line of text
88line
89line of text
90line
91line of text
92line
93line of text
94line
95line "
96string(20) "line of text
97line
98li"
99string(20) "line of text
100line
101li"
102string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
103string(100) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
104string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
105string(95) "ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 ab12 "
106string(20) "ab12 ab12 ab12 ab12 "
107string(20) "ab12 ab12 ab12 ab12 "
108--- Done ---
109