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