Annotation of embedaddon/php/ext/standard/tests/strings/addcslashes_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test addcslashes() function (variation 1)
3: --INI--
4: precision=14
5: --FILE--
6: <?php
7:
8: echo "*** Testing addcslashes() for basic operations ***\n";
9: /* checking normal operation of addcslashes */
10: $string = "goodyear12345NULL\0truefalse\a\v\f\b\n\r\t";
11: $charlist = array (
12: NULL,
13: 2,
14: array(5,6,7),
15: "a",
16: "\0",
17: "\n",
18: "\r",
19: "\t",
20: "\a",
21: "\v",
22: "\b",
23: "\f"
24: );
25: /* loop prints string with backslashes before characters
26: mentioned in $char using addcslashes() */
27: $counter = 1;
28: foreach($charlist as $char) {
29: echo "-- Iteration $counter --\n";
30: var_dump( addcslashes($string, $char) );
31: $counter++;
32: }
33:
34: echo "Done\n";
35:
36: ?>
37: --EXPECTF--
38: *** Testing addcslashes() for basic operations ***
39: -- Iteration 1 --
40: string(36) "goodyear12345NULL truefalse\a\b
41:
"
42: -- Iteration 2 --
43: string(37) "goodyear1\2345NULL truefalse\a\b
44:
"
45: -- Iteration 3 --
46:
47: Warning: addcslashes() expects parameter 2 to be string, array given in %s on line %d
48: NULL
49: -- Iteration 4 --
50: string(39) "goodye\ar12345NULL truef\alse\\a\b
51:
"
52: -- Iteration 5 --
53: string(39) "goodyear12345NULL\000truefalse\a\b
54:
"
55: -- Iteration 6 --
56: string(37) "goodyear12345NULL truefalse\a\b\n
"
57: -- Iteration 7 --
58: string(37) "goodyear12345NULL truefalse\a\b
59: \r "
60: -- Iteration 8 --
61: string(37) "goodyear12345NULL truefalse\a\b
62:
\t"
63: -- Iteration 9 --
64: string(41) "goodye\ar12345NULL truef\alse\\\a\\b
65:
"
66: -- Iteration 10 --
67: string(37) "goodyear12345NULL truefalse\a\v\b
68:
"
69: -- Iteration 11 --
70: string(39) "goodyear12345NULL truefalse\\a\\\b
71:
"
72: -- Iteration 12 --
73: string(37) "goodyear12345NULL truefalse\a\f\b
74:
"
75: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>