strrpos_variation2.phpt [plain text]
--TEST--
Test strrpos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments
--FILE--
<?php
echo "*** Testing strrpos() function: with single quoted strings ***\n";
$haystack = 'Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ';
$needle = array(
'l',
'L',
'HELLO',
'hEllo',
'\t',
'\T',
' ',
'\n',
'\N',
'
',
'\0',
NULL,
null,
FALSE,
false,
'',
' ',
'$',
' $',
'&',
'!#',
'()',
'<=>',
'>',
'=>',
'?',
'@',
'@hEllo',
'12345', '\x23', '#', '\101', 'A',
'456HEE', 42, $haystack );
$count = 1;
for($index=0; $index<count($needle); $index++) {
echo "-- Iteration $count --\n";
var_dump( strrpos($haystack, $needle[$index]) );
var_dump( strrpos($haystack, $needle[$index], $index) );
$count++;
}
echo "*** Done ***";
?>
--EXPECTF--
*** Testing strrpos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
int(32)
-- Iteration 2 --
bool(false)
bool(false)
-- Iteration 3 --
bool(false)
bool(false)
-- Iteration 4 --
bool(false)
bool(false)
-- Iteration 5 --
int(6)
int(6)
-- Iteration 6 --
bool(false)
bool(false)
-- Iteration 7 --
bool(false)
bool(false)
-- Iteration 8 --
int(12)
int(12)
-- Iteration 9 --
bool(false)
bool(false)
-- Iteration 10 --
bool(false)
bool(false)
-- Iteration 11 --
int(10)
int(10)
-- Iteration 12 --
bool(false)
bool(false)
-- Iteration 13 --
bool(false)
bool(false)
-- Iteration 14 --
bool(false)
bool(false)
-- Iteration 15 --
bool(false)
bool(false)
-- Iteration 16 --
bool(false)
bool(false)
-- Iteration 17 --
int(53)
int(53)
-- Iteration 18 --
int(16)
bool(false)
-- Iteration 19 --
int(15)
bool(false)
-- Iteration 20 --
int(17)
bool(false)
-- Iteration 21 --
int(18)
bool(false)
-- Iteration 22 --
int(21)
int(21)
-- Iteration 23 --
int(24)
int(24)
-- Iteration 24 --
int(26)
int(26)
-- Iteration 25 --
int(25)
int(25)
-- Iteration 26 --
int(27)
int(27)
-- Iteration 27 --
int(28)
int(28)
-- Iteration 28 --
bool(false)
bool(false)
-- Iteration 29 --
int(34)
int(34)
-- Iteration 30 --
int(43)
int(43)
-- Iteration 31 --
int(19)
bool(false)
-- Iteration 32 --
int(49)
int(49)
-- Iteration 33 --
bool(false)
bool(false)
-- Iteration 34 --
bool(false)
bool(false)
-- Iteration 35 --
int(23)
bool(false)
-- Iteration 36 --
int(0)
bool(false)
*** Done ***