import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / strrpos_variation13.php
blob28fa8f802f9f845c8fc22f29d0e58b3b924b5a84
1 <?php
2 /* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
3 * Description: Find position of last occurrence of 'needle' in 'haystack'.
4 * Source code: ext/standard/string.c
5 */
7 /* Test strrpos() function with null terminated strings for 'needle' argument
8 * in order to check binary safe
9 */
11 echo "*** Test strrpos() function: binary safe ***\n";
12 $haystack = "\0Hello\0World\0";
14 $needles = array(
15 "Hello".chr(0)."World",
16 chr(0)."Hello\0",
17 chr(0),
18 "Hello\0world",
19 "\0Hello\0world\0",
20 "\0Hello",
21 "Hello\0"
24 for($index = 0; $index < count($needles); $index++ ) {
25 var_dump( strrpos($haystack, $needles[$index]) );
26 var_dump( strrpos($haystack, $needles[$index], $index) );
28 echo "*** Done ***";