Lines Matching refs:strpos
2 Test strpos() function
7 /* Prototype: int strpos ( string $haystack, mixed $needle [, int $offset] );
11 echo "*** Testing basic functionality of strpos() ***\n";
12 var_dump( strpos("test string", "test") );
13 var_dump( strpos("test string", "string") );
14 var_dump( strpos("test string", "strin") );
15 var_dump( strpos("test string", "t s") );
16 var_dump( strpos("test string", "g") );
17 var_dump( strpos("te".chr(0)."st", chr(0)) );
18 var_dump( strpos("tEst", "test") );
19 var_dump( strpos("teSt", "test") );
20 var_dump( @strpos("", "") );
21 var_dump( @strpos("a", "") );
22 var_dump( @strpos("", "a") );
23 var_dump( @strpos("\\\\a", "\\a") );
26 echo "\n*** Testing strpos() to find various needles and a long string ***\n";
68 var_dump( strpos($string, $needles[$i]) );
72 echo "\n*** Testing strpos() with possible variations in offset ***\n";
90 var_dump( strpos($string, "Hello", $offset_values[$i]) );
117 var_dump( strpos("$obj_string", "$obj_needle") );
121 var_dump( strpos($needles, $needles) ); // won't work
122 var_dump( strpos("hello?world,!$%**()%**[][[[&@#~!", "$needles[1]") ); // works
123 var_dump( strpos("hello?world,!$%**()%**[][[[&@#~!", "$needles[2]") ); // works
129 var_dump( strpos($resource1, $resource1) );
130 var_dump( strpos($resource1, $resource2) );
133 var_dump( strpos("", NULL) );
134 var_dump( strpos(NULL, NULL) );
135 var_dump( strpos("a", NULL) );
136 var_dump( strpos("/x0", "0") ); // Hexadecimal NUL
151 var_dump( strpos($string, "abcd") );
152 var_dump( strpos($string, "abcd", 72) ); // 72 -> "\n" in the first line
153 var_dump( strpos($string, "abcd", 73) ); // 73 -> "abcd" in the second line
154 var_dump( strpos($string, "9", (strlen($string)-1)) );
159 var_dump( strpos($str, "\0") );
160 var_dump( strpos($str, NULL) );
161 var_dump( strpos($str, "0") );
168 var_dump( strpos("Hello, world", "$needle") ); // works
169 var_dump( strpos("Hello, world'S", "$needle'S") ); // works
170 var_dump( strpos("Hello, worldS", "$needleS") ); // won't work
173 var_dump( strpos("Hello, worldS", "${needle}S") ); // works
174 var_dump( strpos("Hello, worldS", "{$needle}S") ); // works
181 var_dump( strpos($str, chr(128)) );
183 var_dump( strpos($str, chr(255), 3) );
185 var_dump( strpos($str, chr(256)) );
188 var_dump( strpos($string, "") );
189 var_dump( strpos() ); // zero argument
190 var_dump( strpos("") ); // null argument
191 var_dump( strpos($string) ); // without "needle"
192 var_dump( strpos("a", "b", "c", "d") ); // args > expected
193 var_dump( strpos($string, "test", strlen($string)+1) ); // offset > strlen()
194 var_dump( strpos($string, "test", -1) ); // offset < 0
195 var_dump( strpos(NULL, "") );
203 *** Testing basic functionality of strpos() ***
217 *** Testing strpos() to find various needles and a long string ***
252 *** Testing strpos() with possible variations in offset ***
255 Warning: strpos() expects parameter 3 to be long, string given in %s on line %d
259 Warning: strpos() expects parameter 3 to be long, string given in %s on line %d
269 Warning: strpos() expects parameter 3 to be long, string given in %s on line %d
281 Warning: strpos() expects parameter 1 to be string, array given in %s on line %d
288 Warning: strpos() expects parameter 1 to be string, resource given in %s on line %d
291 Warning: strpos() expects parameter 1 to be string, resource given in %s on line %d
317 Warning: strpos(): Empty needle in %s on line %d
329 Warning: strpos(): Empty needle in %s on line %d
332 Warning: strpos() expects at least 2 parameters, 0 given in %s on line %d
335 Warning: strpos() expects at least 2 parameters, 1 given in %s on line %d
338 Warning: strpos() expects at least 2 parameters, 1 given in %s on line %d
341 Warning: strpos() expects at most 3 parameters, 4 given in %s on line %d
344 Warning: strpos(): Offset not contained in string in %s on line %d
347 Warning: strpos(): Offset not contained in string in %s on line %d
350 Warning: strpos(): Empty needle in %s on line %d