Return to strrev_variation3.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 - heredoc 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 heredoc strings for 'str' */ 11: 12: echo "*** Testing strrev() function: with heredoc strings ***\n"; 13: $multi_line_str = <<<EOD 14: Example of string 15: spanning multiple lines 16: using heredoc syntax. 17: EOD; 18: 19: $special_chars_str = <<<EOD 20: Ex'ple of h'doc st'g, contains 21: $#%^*&*_("_")!#@@!$#$^^&*(special) 22: chars. 23: EOD; 24: 25: $control_chars_str = <<<EOD 26: Hello, World\n 27: Hello\0World 28: EOD; 29: 30: $quote_chars_str = <<<EOD 31: it's bright o'side 32: "things in double quote" 33: 'things in single quote' 34: this\line is /with\slashs 35: EOD; 36: 37: $blank_line = <<<EOD 38: 39: EOD; 40: 41: $empty_str = <<<EOD 42: EOD; 43: 44: $strings = array( 45: $multi_line_str, 46: $special_chars_str, 47: $control_chars_str, 48: $quote_chars_str, 49: $blank_line, 50: $empty_str 51: ); 52: 53: $count = 1; 54: for( $index = 0; $index < count($strings); $index++ ) { 55: echo "\n-- Iteration $count --\n"; 56: var_dump( strrev($strings[$index]) ); 57: $count ++; 58: } 59: 60: echo "*** Done ***"; 61: ?> 62: --EXPECTF-- 63: *** Testing strrev() function: with heredoc strings *** 64: 65: -- Iteration 1 -- 66: string(63) ".xatnys codereh gnisu 67: senil elpitlum gninnaps 68: gnirts fo elpmaxE" 69: 70: -- Iteration 2 -- 71: string(72) ".srahc 72: )laiceps(*&^^$#$!@@#!)"_"(_*&*^%#$ 73: sniatnoc ,g'ts cod'h fo elp'xE" 74: 75: -- Iteration 3 -- 76: string(25) "dlroW olleH 77: 78: dlroW ,olleH" 79: 80: -- Iteration 4 -- 81: string(94) "shsals\htiw/ si enil\siht 82: 'etouq elgnis ni sgniht' 83: "etouq elbuod ni sgniht" 84: edis'o thgirb s'ti" 85: 86: -- Iteration 5 -- 87: string(0) "" 88: 89: -- Iteration 6 -- 90: string(0) "" 91: *** Done ***