xref: /PHP-5.4/ext/standard/tests/file/fgetss1.phpt (revision 963b1db6)
1--TEST--
2more fgetss() tests
3--FILE--
4<?php
5
6$filename = dirname(__FILE__)."/fgetss1.html";
7
8$array = array(
9	"askasdfasdf<b>aaaaaa\n</b>dddddd",
10	"asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
11	"aaa<script>function foo() {}</script>qqq",
12	"asdasd<a\n asdjeje",
13	"",
14	"some text \n<b>blah</i>",
15	"some another text <> hoho </>"
16	);
17
18foreach ($array as $str) {
19	file_put_contents($filename, $str);
20	$fp = fopen($filename, "r");
21	var_dump(fgetss($fp, 1000, "<i>,<b>,<a>"));
22	var_dump(fgetss($fp));
23}
24
25foreach ($array as $str) {
26	file_put_contents($filename, $str);
27	$fp = fopen($filename, "r");
28	var_dump(fgetss($fp, 10));
29	var_dump(fgetss($fp, 10, "<script>,<a>"));
30}
31
32@unlink($filename);
33
34echo "Done\n";
35?>
36--EXPECTF--
37string(21) "askasdfasdf<b>aaaaaa
38"
39string(6) "dddddd"
40string(28) "asdqw<i onClick="hello();">
41"
42string(8) "aaaaqqqq"
43string(23) "aaafunction foo() {}qqq"
44bool(false)
45string(6) "asdasd"
46string(0) ""
47bool(false)
48bool(false)
49string(11) "some text
50"
51string(4) "blah"
52string(24) "some another text  hoho "
53bool(false)
54string(9) "askasdfas"
55string(6) "dfaaaa"
56string(5) "asdqw"
57string(0) ""
58string(3) "aaa"
59string(9) "t>functio"
60string(6) "asdasd"
61string(0) ""
62bool(false)
63bool(false)
64string(9) "some text"
65string(2) "
66"
67string(9) "some anot"
68string(9) "her text "
69Done
70