1--TEST-- 2Test strrev() function : usage variations - single quoted strings 3--FILE-- 4<?php 5/* Testing strrev() function with various single quoted strings for 'str' */ 6 7echo "*** Testing strrev() : with various single 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 string 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 single quoted strings *** 66 67-- Iteration 1 -- 68string(11) "dlrow\olleh" 69 70-- Iteration 2 -- 71string(12) "dlrow$\olleh" 72 73-- Iteration 3 -- 74string(26) "verrtst\gnitsett\gnitsett\" 75 76-- Iteration 4 -- 77string(30) "verrts gnitset verrtsr\gnitset" 78 79-- Iteration 5 -- 80string(35) "verrtsn\ gnitset f\ verrtsf\gnitset" 81 82-- Iteration 6 -- 83string(37) "verrts n\ gnitset n\verrtsn\gnitsetn\" 84 85-- Iteration 7 -- 86string(20) "batv\lacitrevv\gnisu" 87 88-- Iteration 8 -- 89string(10) "HelloolleH" 90 91-- Iteration 9 -- 92string(13) "ababababababa" 93 94-- Iteration 10 -- 95string(8) "321olleH" 96 97-- Iteration 11 -- 98string(8) "olleH321" 99 100-- Iteration 12 -- 101string(11) "olleH43.321" 102 103-- Iteration 13 -- 104string(10) "432.1olleH" 105 106-- Iteration 14 -- 107string(13) "432.1olleH321" 108 109-- Iteration 15 -- 110string(11) "dlroWolleH" 111 112-- Iteration 16 -- 113string(10) "dlrowolleH" 114 115-- Iteration 17 -- 116string(10) "iiiiHolleH" 117 118-- Iteration 18 -- 119string(15) "h " 120 121-- Iteration 19 -- 122string(15) " h" 123 124-- Iteration 20 -- 125string(15) " h " 126 127-- Iteration 21 -- 128string(15) " o l l e h" 129 130-- Iteration 22 -- 131string(12) "dlrow'olleh\" 132 133-- Iteration 23 -- 134string(12) "dlrow"\olleh" 135 136-- Iteration 24 -- 137string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t" 138 139-- Iteration 25 -- 140string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!" 141 142-- Iteration 26 -- 143string(28) "/uu/ u\t\verrts\tset\r/tset/" 144 145-- Iteration 27 -- 146string(16) "~`-=+_)(*&^%$#@!" 147*** Done *** 148