Annotation of embedaddon/php/ext/standard/tests/strings/strrchr_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test strrchr() function : usage variations - double quoted strings
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string strrchr(string $haystack, string $needle);
                      6:  * Description: Finds the last occurrence of a character in a string.
                      7:  * Source code: ext/standard/string.c
                      8: */
                      9: 
                     10: /* Test strrchr() function by passing various double quoted strings for 'haystack' & 'needle' */
                     11: 
                     12: echo "*** Testing strrchr() function: with various double quoted strings ***";
                     13: $haystack = "Hello,\t\n\0\n  $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 ";
                     14: $needle = array(
                     15:   //regular strings
                     16:   "l",
                     17:   "L",
                     18:   "HELLO", 
                     19:   "hEllo",
                     20: 
                     21:   //escape characters
                     22:   "\t",
                     23:   "\T",
                     24:   "    ",
                     25:   "\n",
                     26:   "\N",
                     27:   "
                     28: ",  //new line
                     29: 
                     30:   //nulls
                     31:   "\0",
                     32:   NULL,
                     33:   null,
                     34:   
                     35:   //boolean false
                     36:   FALSE,
                     37:   false,
                     38: 
                     39:   //empty string
                     40:   "",  
                     41: 
                     42:   //special chars
                     43:   " ",
                     44:   "$",
                     45:   " $",
                     46:   "&",
                     47:   "!#",
                     48:   "%\o",
                     49:   "\o,",
                     50:   "()",
                     51:   "*+",
                     52:   "+",
                     53:   "-",
                     54:   ".",
                     55:   ".;",
                     56:   ":;",
                     57:   ";",
                     58:   "<=>",
                     59:   ">",
                     60:   "=>",
                     61:   "?",
                     62:   "@", 
                     63:   "@hEllo", 
                     64: 
                     65:   "12345", //decimal numeric string
                     66:   "\x23",  //hexadecimal numeric string
                     67:   "#",  //respective ASCII char of \x23
                     68:   "\101",  //octal numeric string
                     69:   "A",  //respective ASCII char of \101
                     70:   "456HEE",  //numerics + chars
                     71:   42, //needle as int(ASCII value of "*")
                     72:   $haystack  //haystack as needle
                     73: );
                     74: 
                     75: /* loop through to get the position of the needle in haystack string */
                     76: $count = 1;
                     77: for($index=0; $index<count($needle); $index++) {
                     78:   echo "\n-- Iteration $count --\n";
                     79:   var_dump( strrchr($haystack, $needle[$index]) );
                     80:   $count++;
                     81: }
                     82: echo "*** Done ***";
                     83: ?>
                     84: --EXPECTF--
                     85: *** Testing strrchr() function: with various double quoted strings ***
                     86: -- Iteration 1 --
                     87: string(16) "lo123456he #4 A "
                     88: 
                     89: -- Iteration 2 --
                     90: bool(false)
                     91: 
                     92: -- Iteration 3 --
                     93: string(53) "Hello,     
                     94: 
                     95:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                     96: 
                     97: -- Iteration 4 --
                     98: string(8) "he #4 A "
                     99: 
                    100: -- Iteration 5 --
                    101: string(47) "   
                    102: 
                    103:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    104: 
                    105: -- Iteration 6 --
                    106: string(36) "\o,()*+-./:;<=>?@hello123456he #4 A "
                    107: 
                    108: -- Iteration 7 --
                    109: string(47) "   
                    110: 
                    111:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    112: 
                    113: -- Iteration 8 --
                    114: string(44) "
                    115:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    116: 
                    117: -- Iteration 9 --
                    118: string(36) "\o,()*+-./:;<=>?@hello123456he #4 A "
                    119: 
                    120: -- Iteration 10 --
                    121: string(44) "
                    122:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    123: 
                    124: -- Iteration 11 --
                    125: string(45) "
                    126:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    127: 
                    128: -- Iteration 12 --
                    129: string(45) "
                    130:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    131: 
                    132: -- Iteration 13 --
                    133: string(45) "
                    134:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    135: 
                    136: -- Iteration 14 --
                    137: string(45) "
                    138:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    139: 
                    140: -- Iteration 15 --
                    141: string(45) "
                    142:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    143: 
                    144: -- Iteration 16 --
                    145: string(45) "
                    146:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    147: 
                    148: -- Iteration 17 --
                    149: string(1) " "
                    150: 
                    151: -- Iteration 18 --
                    152: string(41) "$&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    153: 
                    154: -- Iteration 19 --
                    155: string(1) " "
                    156: 
                    157: -- Iteration 20 --
                    158: string(40) "&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    159: 
                    160: -- Iteration 21 --
                    161: string(39) "!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    162: 
                    163: -- Iteration 22 --
                    164: string(37) "%\o,()*+-./:;<=>?@hello123456he #4 A "
                    165: 
                    166: -- Iteration 23 --
                    167: string(36) "\o,()*+-./:;<=>?@hello123456he #4 A "
                    168: 
                    169: -- Iteration 24 --
                    170: string(33) "()*+-./:;<=>?@hello123456he #4 A "
                    171: 
                    172: -- Iteration 25 --
                    173: string(31) "*+-./:;<=>?@hello123456he #4 A "
                    174: 
                    175: -- Iteration 26 --
                    176: string(30) "+-./:;<=>?@hello123456he #4 A "
                    177: 
                    178: -- Iteration 27 --
                    179: string(29) "-./:;<=>?@hello123456he #4 A "
                    180: 
                    181: -- Iteration 28 --
                    182: string(28) "./:;<=>?@hello123456he #4 A "
                    183: 
                    184: -- Iteration 29 --
                    185: string(28) "./:;<=>?@hello123456he #4 A "
                    186: 
                    187: -- Iteration 30 --
                    188: string(26) ":;<=>?@hello123456he #4 A "
                    189: 
                    190: -- Iteration 31 --
                    191: string(25) ";<=>?@hello123456he #4 A "
                    192: 
                    193: -- Iteration 32 --
                    194: string(24) "<=>?@hello123456he #4 A "
                    195: 
                    196: -- Iteration 33 --
                    197: string(22) ">?@hello123456he #4 A "
                    198: 
                    199: -- Iteration 34 --
                    200: string(23) "=>?@hello123456he #4 A "
                    201: 
                    202: -- Iteration 35 --
                    203: string(21) "?@hello123456he #4 A "
                    204: 
                    205: -- Iteration 36 --
                    206: string(20) "@hello123456he #4 A "
                    207: 
                    208: -- Iteration 37 --
                    209: string(20) "@hello123456he #4 A "
                    210: 
                    211: -- Iteration 38 --
                    212: string(14) "123456he #4 A "
                    213: 
                    214: -- Iteration 39 --
                    215: string(5) "#4 A "
                    216: 
                    217: -- Iteration 40 --
                    218: string(5) "#4 A "
                    219: 
                    220: -- Iteration 41 --
                    221: string(2) "A "
                    222: 
                    223: -- Iteration 42 --
                    224: string(2) "A "
                    225: 
                    226: -- Iteration 43 --
                    227: string(4) "4 A "
                    228: 
                    229: -- Iteration 44 --
                    230: string(31) "*+-./:;<=>?@hello123456he #4 A "
                    231: 
                    232: -- Iteration 45 --
                    233: string(53) "Hello,     
                    234: 
                    235:   $&!#%\o,()*+-./:;<=>?@hello123456he #4 A "
                    236: *** Done ***

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>