1--TEST-- 2Test strrev() function : usage variations - double quoted strings 3--FILE-- 4<?php 5/* Testing strrev() function with various double quoted strings for 'str' */ 6 7echo "*** Testing strrev() : with various double quoted strings ***\n"; 8$str = "Hiiii"; 9 10$strings = array( 11 //strings containing escape chars 12 "hello\\world", 13 "hello\$world", 14 "\ttesting\ttesting\tstrrev", 15 "testing\rstrrev testing strrev", 16 "testing\fstrrev \f testing \nstrrev", 17 "\ntesting\nstrrev\n testing \n strrev", 18 "using\vvertical\vtab", 19 20 //polyndrome strings 21 "HelloolleH", 22 "ababababababa", 23 24 //numeric + strings 25 "Hello123", 26 "123Hello", 27 "123.34Hello", 28 "Hello1.234", 29 "123Hello1.234", 30 31 //concatenated strings 32 "Hello".chr(0)."World", 33 "Hello"."world", 34 "Hello".$str, 35 36 //strings containing white spaces 37 " h", 38 "h ", 39 " h ", 40 "h e l l o ", 41 42 //strings containing quotes 43 "\hello\'world", 44 "hello\"world", 45 46 //special chars in strings 47 "t@@#$% %test ^test &test *test +test -test", 48 "!test ~test `test` =test= @test@test.com", 49 "/test/r\test\strrev\t\\u /uu/", 50 51 //only special chars 52 "!@#$%^&*()_+=-`~" 53); 54 55$count = 1; 56for( $index = 0; $index < count($strings); $index++ ) { 57 echo "\n-- Iteration $count --\n"; 58 var_dump( strrev($strings[$index]) ); 59 $count ++; 60} 61 62echo "*** Done ***"; 63?> 64--EXPECT-- 65*** Testing strrev() : with various double quoted strings *** 66 67-- Iteration 1 -- 68string(11) "dlrow\olleh" 69 70-- Iteration 2 -- 71string(11) "dlrow$olleh" 72 73-- Iteration 3 -- 74string(23) "verrts gnitset gnitset " 75 76-- Iteration 4 -- 77string(29) "verrts gnitset verrts 77gnitset" 78 79-- Iteration 5 -- 80string(32) "verrts 81 gnitset verrtsgnitset" 82 83-- Iteration 6 -- 84string(33) "verrts 85 gnitset 86verrts 87gnitset 88" 89 90-- Iteration 7 -- 91string(18) "batlacitrevgnisu" 92 93-- Iteration 8 -- 94string(10) "HelloolleH" 95 96-- Iteration 9 -- 97string(13) "ababababababa" 98 99-- Iteration 10 -- 100string(8) "321olleH" 101 102-- Iteration 11 -- 103string(8) "olleH321" 104 105-- Iteration 12 -- 106string(11) "olleH43.321" 107 108-- Iteration 13 -- 109string(10) "432.1olleH" 110 111-- Iteration 14 -- 112string(13) "432.1olleH321" 113 114-- Iteration 15 -- 115string(11) "dlroWolleH" 116 117-- Iteration 16 -- 118string(10) "dlrowolleH" 119 120-- Iteration 17 -- 121string(10) "iiiiHolleH" 122 123-- Iteration 18 -- 124string(15) "h " 125 126-- Iteration 19 -- 127string(15) " h" 128 129-- Iteration 20 -- 130string(15) " h " 131 132-- Iteration 21 -- 133string(15) " o l l e h" 134 135-- Iteration 22 -- 136string(13) "dlrow'\olleh\" 137 138-- Iteration 23 -- 139string(11) "dlrow"olleh" 140 141-- Iteration 24 -- 142string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t" 143 144-- Iteration 25 -- 145string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!" 146 147-- Iteration 26 -- 148string(26) "/uu/ u\ verrts\tse r/tset/" 149 150-- Iteration 27 -- 151string(16) "~`-=+_)(*&^%$#@!" 152*** Done *** 153