2007-09-26 14:42:15 +00:00
|
|
|
|
--TEST--
|
|
|
|
|
Test strrev() function : usage variations - double quoted strings
|
|
|
|
|
--FILE--
|
|
|
|
|
<?php
|
|
|
|
|
/* Prototype : string strrev(string $str);
|
|
|
|
|
* Description: Reverse a string
|
|
|
|
|
* Source code: ext/standard/string.c
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Testing strrev() function with various double quoted strings */
|
|
|
|
|
|
|
|
|
|
echo "*** Testing strrev() : with various double quoted strings ***\n";
|
|
|
|
|
$str = "Hiiii";
|
|
|
|
|
|
|
|
|
|
$strings = array(
|
|
|
|
|
//strings containing escape chars
|
|
|
|
|
"hello\\world",
|
|
|
|
|
"hello\$world",
|
|
|
|
|
"\ttesting\ttesting\tstrrev",
|
|
|
|
|
"testing\rstrrev testing strrev",
|
|
|
|
|
"testing\fstrrev \f testing \nstrrev",
|
|
|
|
|
"\ntesting\nstrrev\n testing \n strrev",
|
|
|
|
|
"using\vvertical\vtab",
|
|
|
|
|
|
|
|
|
|
//polyndrome strings
|
|
|
|
|
"HelloolleH",
|
|
|
|
|
"ababababababa",
|
|
|
|
|
|
|
|
|
|
//numeric + strings
|
|
|
|
|
"Hello123",
|
|
|
|
|
"123Hello",
|
|
|
|
|
"123.34Hello",
|
|
|
|
|
"Hello1.234",
|
|
|
|
|
"123Hello1.234",
|
|
|
|
|
|
|
|
|
|
//concatenated strings
|
|
|
|
|
"Hello".chr(0)."World",
|
|
|
|
|
"Hello"."world",
|
|
|
|
|
"Hello".$str,
|
|
|
|
|
|
|
|
|
|
//strings containing white spaces
|
|
|
|
|
" h",
|
|
|
|
|
"h ",
|
|
|
|
|
" h ",
|
|
|
|
|
"h e l l o ",
|
|
|
|
|
|
|
|
|
|
//strings containing quotes
|
|
|
|
|
"\hello\'world",
|
|
|
|
|
"hello\"world",
|
|
|
|
|
|
|
|
|
|
//special chars in strings
|
|
|
|
|
"t@@#$% %test ^test &test *test +test -test",
|
|
|
|
|
"!test ~test `test` =test= @test@test.com",
|
|
|
|
|
"/test/r\test\strrev\t\u12ab /uu/",
|
|
|
|
|
|
|
|
|
|
//only special chars
|
|
|
|
|
"!@#$%^&*()_+=-`~"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$count = 1;
|
|
|
|
|
for( $index = 0; $index < count($strings); $index++ ) {
|
|
|
|
|
echo "\n-- Iteration $count --\n";
|
|
|
|
|
var_dump( strrev($strings[$index]) );
|
|
|
|
|
$count ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "*** Done ***";
|
|
|
|
|
?>
|
2008-05-27 10:50:48 +00:00
|
|
|
|
--EXPECT--
|
2007-09-26 14:42:15 +00:00
|
|
|
|
*** Testing strrev() : with various double quoted strings ***
|
|
|
|
|
|
|
|
|
|
-- Iteration 1 --
|
|
|
|
|
unicode(11) "dlrow\olleh"
|
|
|
|
|
|
|
|
|
|
-- Iteration 2 --
|
|
|
|
|
unicode(11) "dlrow$olleh"
|
|
|
|
|
|
|
|
|
|
-- Iteration 3 --
|
|
|
|
|
unicode(23) "verrts gnitset gnitset "
|
|
|
|
|
|
|
|
|
|
-- Iteration 4 --
|
2009-07-15 14:08:18 +00:00
|
|
|
|
unicode(29) "verrts gnitset verrts
gnitset"
|
2007-09-26 14:42:15 +00:00
|
|
|
|
|
|
|
|
|
-- Iteration 5 --
|
|
|
|
|
unicode(32) "verrts
|
|
|
|
|
gnitset verrtsgnitset"
|
|
|
|
|
|
|
|
|
|
-- Iteration 6 --
|
|
|
|
|
unicode(33) "verrts
|
|
|
|
|
gnitset
|
|
|
|
|
verrts
|
|
|
|
|
gnitset
|
|
|
|
|
"
|
|
|
|
|
|
|
|
|
|
-- Iteration 7 --
|
|
|
|
|
unicode(18) "batlacitrevgnisu"
|
|
|
|
|
|
|
|
|
|
-- Iteration 8 --
|
|
|
|
|
unicode(10) "HelloolleH"
|
|
|
|
|
|
|
|
|
|
-- Iteration 9 --
|
|
|
|
|
unicode(13) "ababababababa"
|
|
|
|
|
|
|
|
|
|
-- Iteration 10 --
|
|
|
|
|
unicode(8) "321olleH"
|
|
|
|
|
|
|
|
|
|
-- Iteration 11 --
|
|
|
|
|
unicode(8) "olleH321"
|
|
|
|
|
|
|
|
|
|
-- Iteration 12 --
|
|
|
|
|
unicode(11) "olleH43.321"
|
|
|
|
|
|
|
|
|
|
-- Iteration 13 --
|
|
|
|
|
unicode(10) "432.1olleH"
|
|
|
|
|
|
|
|
|
|
-- Iteration 14 --
|
|
|
|
|
unicode(13) "432.1olleH321"
|
|
|
|
|
|
|
|
|
|
-- Iteration 15 --
|
|
|
|
|
unicode(11) "dlroW |