php-src/ext/standard/tests/strings/strrpos_basic1.phpt
Steph Fox 87fac43ac0 - killed off UEXPECT
- html_translation_table and setlocale tests are no longer relevant
- there are a number of ANSI-encoded files. Is this deliberate?
2008-05-27 10:50:48 +00:00

52 lines
1.3 KiB
PHP

--TEST--
Test strrpos() function : basic functionality - with default arguments
--FILE--
<?php
/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
* Description: Find position of last occurrence of 'needle' in 'haystack'
* Source code: ext/standard/string.c
*/
echo "*** Testing strrpos() function: basic functionality ***\n";
$heredoc_str = <<<EOD
Hello, World
EOD;
echo "-- With default arguments --\n";
//regular string for haystack & needle
var_dump( strrpos("Hello, World", "Hello") );
var_dump( strrpos('Hello, World', "hello") );
var_dump( strrpos("Hello, World", 'World') );
var_dump( strrpos('Hello, World', 'WORLD') );
//single char for needle
var_dump( strrpos("Hello, World", "o") );
var_dump( strrpos("Hello, World", ",") );
//heredoc string for haystack & needle
var_dump( strrpos($heredoc_str, "Hello, World") );
var_dump( strrpos($heredoc_str, 'Hello') );
var_dump( strrpos($heredoc_str, $heredoc_str) );
//unicodes
var_dump( strrpos("Hello, World", (unicode)"o") );
var_dump( strrpos((unicode)"Hello, World", ",") );
echo "*** Done ***";
?>
--EXPECT--
*** Testing strrpos() function: basic functionality ***
-- With default arguments --
int(0)
bool(false)
int(7)
bool(false)
int(8)
int(5)
int(0)
int(0)
int(0)
int(8)
int(5)
*** Done ***