import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / strrpos_basic1.php
blobd230374ba1ef525839c3bfacaea79356eeb7dbc9
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 echo "*** Testing strrpos() function: basic functionality ***\n";
8 $heredoc_str = <<<EOD
9 Hello, World
10 EOD;
12 echo "-- With default arguments --\n";
13 //regular string for haystack & needle
14 var_dump( strrpos("Hello, World", "Hello") );
15 var_dump( strrpos('Hello, World', "hello") );
16 var_dump( strrpos("Hello, World", 'World') );
17 var_dump( strrpos('Hello, World', 'WORLD') );
19 //single char for needle
20 var_dump( strrpos("Hello, World", "o") );
21 var_dump( strrpos("Hello, World", ",") );
23 //heredoc string for haystack & needle
24 var_dump( strrpos($heredoc_str, "Hello, World") );
25 var_dump( strrpos($heredoc_str, 'Hello') );
26 var_dump( strrpos($heredoc_str, $heredoc_str) );
28 echo "*** Done ***";