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";
93 var_dump( strpos($string, "Hello", $offset_values[$i]) );
120 var_dump( strpos("$obj_string", "$obj_needle") );
124 var_dump( strpos($needles, $needles) ); // won't work
125 var_dump( strpos("hello?world,!$%**()%**[][[[&@#~!", "$needles[1]") ); // works
126 var_dump( strpos("hello?world,!$%**()%**[][[[&@#~!", "$needles[2]") ); // works
132 var_dump( strpos($resource1, $resource1) );
133 var_dump( strpos($resource1, $resource2) );
136 var_dump( strpos("", NULL) );
137 var_dump( strpos(NULL, NULL) );
138 var_dump( strpos("a", NULL) );
139 var_dump( strpos("/x0", "0") ); // Hexadecimal NUL
154 var_dump( strpos($string, "abcd") );
155 var_dump( strpos($string, "abcd", 72) ); // 72 -> "\n" in the first line
156 var_dump( strpos($string, "abcd", 73) ); // 73 -> "abcd" in the second line
157 var_dump( strpos($string, "9", (strlen($string)-1)) );
162 var_dump( strpos($str, "\0") );
163 var_dump( strpos($str, NULL) );
164 var_dump( strpos($str, "0") );
171 var_dump( strpos("Hello, world", "$needle") ); // works
172 var_dump( strpos("Hello, world'S", "$needle'S") ); // works
173 var_dump( strpos("Hello, worldS", "$needleS") ); // won't work
176 var_dump( strpos("Hello, worldS", "${needle}S") ); // works
177 var_dump( strpos("Hello, worldS", "{$needle}S") ); // works
184 var_dump( strpos($str, chr(128)) );
186 var_dump( strpos($str, chr(255), 3) );
188 var_dump( strpos($str, chr(256)) );
191 var_dump( strpos($string, "") );
192 var_dump( strpos() ); // zero argument
193 var_dump( strpos("") ); // null argument
194 var_dump( strpos($string) ); // without "needle"
195 var_dump( strpos("a", "b", "c", "d") ); // args > expected
196 var_dump( strpos($string, "test", strlen($string)+1) ); // offset > strlen()
197 var_dump( strpos($string, "test", -strlen($string)-1) ); // offset before start
198 var_dump( strpos(NULL, "") );
206 *** Testing basic functionality of strpos() ***
220 *** Testing strpos() to find various needles and a long string ***
255 *** Testing strpos() with possible variations in offset ***
258 Warning: strpos() expects parameter 3 to be integer, string given in %s on line %d
262 Warning: strpos() expects parameter 3 to be integer, string given in %s on line %d
272 Warning: strpos() expects parameter 3 to be integer, string given in %s on line %d
287 Warning: strpos() expects parameter 1 to be string, array given in %s on line %d
294 Warning: strpos() expects parameter 1 to be string, resource given in %s on line %d
297 Warning: strpos() expects parameter 1 to be string, resource given in %s on line %d
323 Warning: strpos(): Empty needle in %s on line %d
335 Warning: strpos(): Empty needle in %s on line %d
338 Warning: strpos() expects at least 2 parameters, 0 given in %s on line %d
341 Warning: strpos() expects at least 2 parameters, 1 given in %s on line %d
344 Warning: strpos() expects at least 2 parameters, 1 given in %s on line %d
347 Warning: strpos() expects at most 3 parameters, 4 given in %s on line %d
350 Warning: strpos(): Offset not contained in string in %s on line %d
353 Warning: strpos(): Offset not contained in string in %s on line %d
356 Warning: strpos(): Empty needle in %s on line %d