Annotation of embedaddon/php/ext/standard/tests/strings/str_replace.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test str_replace() function
        !             3: --INI--
        !             4: precision=14
        !             5: --FILE--
        !             6: <?php
        !             7: /* 
        !             8:   Prototype: mixed str_replace(mixed $search, mixed $replace, 
        !             9:                                mixed $subject [, int &$count]);
        !            10:   Description: Replace all occurrences of the search string with 
        !            11:                the replacement string
        !            12: */
        !            13: 
        !            14: echo "\n*** Testing str_replace() on basic operations ***\n";
        !            15: 
        !            16: var_dump( str_replace("", "", "") );
        !            17: 
        !            18: var_dump( str_replace("e", "b", "test") );
        !            19: 
        !            20: var_dump( str_replace("", "", "", $count) );
        !            21: var_dump( $count );
        !            22: 
        !            23: var_dump( str_replace("q", "q", "q", $count) );
        !            24: var_dump( $count );
        !            25: 
        !            26: var_dump( str_replace("long string here", "", "", $count) );
        !            27: var_dump( $count );
        !            28: 
        !            29: $fp = fopen( __FILE__, "r" );
        !            30: $fp_copy = $fp; 
        !            31: var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
        !            32: var_dump( $fp_copy );
        !            33: fclose($fp);
        !            34: 
        !            35: echo "\n*** Testing str_replace() with various search values ***";
        !            36: $search_arr = array( TRUE, FALSE, 1, 0, -1, "1", "0", "-1",  NULL, 
        !            37:                      array(), "php", "");
        !            38: 
        !            39: $i = 0;
        !            40: /* loop through to replace the matched elements in the array */
        !            41: foreach( $search_arr as $value ) {
        !            42:   echo "\n-- Iteration $i --\n";
        !            43:   /* replace the string in array */
        !            44:   var_dump( str_replace($value, "FOUND", $search_arr, $count) ); 
        !            45:   var_dump( $count );
        !            46:   $i++;
        !            47: }
        !            48: 
        !            49: echo "\n*** Testing str_replace() with various subjects ***";
        !            50: $subject = "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE\000
        !            51:            \x000\xABCD\0abcd \xXYZ\tabcd $$@#%^&*!~,.:;?: !!Hello, World 
        !            52:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)";
        !            53: 
        !            54: /* needles in an array to be compared in the string $string */
        !            55: $search_str = array ( 
        !            56:   "Hello, World",
        !            57:   'Hello, World',
        !            58:   '!!Hello, World',
        !            59:   "??Hello, World",
        !            60:   "$@#%^&*!~,.:;?",
        !            61:   "123",
        !            62:   123,
        !            63:   "-1.2345",
        !            64:   -1.2344,
        !            65:   "abcd",
        !            66:   'XYZ',
        !            67:   NULL,
        !            68:   "NULL",
        !            69:   "0",
        !            70:   0,
        !            71:   "",
        !            72:   " ",
        !            73:   "\0",
        !            74:   "\x000",
        !            75:   "\xABC",
        !            76:   "\0000",
        !            77:   ".3",
        !            78:   TRUE,
        !            79:   "TRUE",
        !            80:   "1",
        !            81:   1,
        !            82:   FALSE,
        !            83:   "FALSE",
        !            84:   " ",
        !            85:   "          ",
        !            86:   'b',
        !            87:   '\t',
        !            88:   "\t",
        !            89:   chr(128).chr(234).chr(65).chr(255).chr(256),
        !            90:   $subject
        !            91: );
        !            92: 
        !            93: /* loop through to get the  $string */
        !            94: for( $i = 0; $i < count($search_str); $i++ ) {
        !            95:   echo "\n--- Iteration $i ---";
        !            96:   echo "\n-- String after replacing the search value is => --\n";
        !            97:   var_dump( str_replace($search_str[$i], "FOUND", $subject, $count) );
        !            98:   echo "-- search string has found '$count' times\n";
        !            99: }
        !           100:   
        !           101: 
        !           102: echo "\n*** Testing Miscelleneous input data ***\n";
        !           103: /*  If replace has fewer values than search, then an empty 
        !           104:     string is used for the rest of replacement values */
        !           105: var_dump( str_replace(array("a", "a", "b"), 
        !           106:                      array("q", "q"), 
        !           107:                      "aaabb", $count
        !           108:                     )
        !           109:        );
        !           110: var_dump($count);
        !           111: var_dump( str_replace(array("a", "a", "b"), 
        !           112:                       array("q", "q"), 
        !           113:                       array("aaa", "bbb", "ccc"), 
        !           114:                       $count
        !           115:                      )
        !           116:         );
        !           117: var_dump($count);
        !           118: 
        !           119: 
        !           120: echo "\n-- Testing objects --\n";
        !           121: /* we get "Catchable fatal error: saying Object of class could not be converted
        !           122:         to string" by default, when an object is passed instead of string:
        !           123: The error can be  avoided by chosing the __toString magix method as follows: */
        !           124: 
        !           125: class subject 
        !           126: {
        !           127:   function __toString() {
        !           128:     return "Hello, world";
        !           129:   }
        !           130: }
        !           131: $obj_subject = new subject;
        !           132: 
        !           133: class search 
        !           134: {
        !           135:   function __toString() {
        !           136:     return "Hello, world";
        !           137:   }
        !           138: }
        !           139: $obj_search = new search;
        !           140: 
        !           141: class replace 
        !           142: {
        !           143:   function __toString() {
        !           144:     return "Hello, world";
        !           145:   }
        !           146: }
        !           147: $obj_replace = new replace;
        !           148: 
        !           149: var_dump(str_replace("$obj_search", "$obj_replace", "$obj_subject", $count));
        !           150: var_dump($count);
        !           151: 
        !           152: 
        !           153: echo "\n-- Testing arrays --\n";
        !           154: var_dump(str_replace(array("a", "a", "b"), "multi", "aaa", $count));
        !           155: var_dump($count);
        !           156: 
        !           157: var_dump(str_replace( array("a", "a", "b"),
        !           158:                       array("q", "q", "c"), 
        !           159:                       "aaa", $count
        !           160:                     )
        !           161: );
        !           162: var_dump($count);
        !           163: 
        !           164: var_dump(str_replace( array("a", "a", "b"),
        !           165:                       array("q", "q", "c"), 
        !           166:                       array("aaa", "bbb"), 
        !           167:                       $count
        !           168:                     )
        !           169: );
        !           170: var_dump($count);
        !           171: 
        !           172: var_dump(str_replace("a", array("q", "q", "c"), array("aaa", "bbb"), $count));
        !           173: var_dump($count);
        !           174: 
        !           175: var_dump(str_replace("a", 1, array("aaa", "bbb"), $count));
        !           176: var_dump($count);
        !           177: 
        !           178: var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count));
        !           179: var_dump($count);
        !           180: 
        !           181: 
        !           182: echo "\n-- Testing Resources --\n";
        !           183: $resource1 = fopen( __FILE__, "r" );
        !           184: $resource2 = opendir( "." );
        !           185: var_dump(str_replace("stream", "FOUND", $resource1, $count)); 
        !           186: var_dump($count);
        !           187: var_dump(str_replace("stream", "FOUND", $resource2, $count));
        !           188: var_dump($count);
        !           189: 
        !           190: 
        !           191: echo "\n-- Testing a longer and heredoc string --\n";
        !           192: $string = <<<EOD
        !           193: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           194: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           195: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           196: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           197: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           198: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           199: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           200: @#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
        !           201: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
        !           202: EOD;
        !           203: 
        !           204: var_dump( str_replace("abcdef", "FOUND", $string, $count) );
        !           205: var_dump( $count );
        !           206: 
        !           207: echo "\n-- Testing a heredoc null string --\n";
        !           208: $str = <<<EOD
        !           209: EOD;
        !           210: var_dump( str_replace("", "FOUND", $str, $count) );
        !           211: var_dump( $count );
        !           212: 
        !           213: 
        !           214: echo "\n-- Testing simple and complex syntax strings --\n";
        !           215: $str = 'world';
        !           216: 
        !           217: /* Simple syntax */
        !           218: var_dump( str_replace("world", "FOUND", "$str") );
        !           219: var_dump( str_replace("world'S", "FOUND", "$str'S") );
        !           220: var_dump( str_replace("worldS", "FOUND", "$strS") );
        !           221: 
        !           222: /* String with curly braces, complex syntax */
        !           223: var_dump( str_replace("worldS", "FOUND", "${str}S") );
        !           224: var_dump( str_replace("worldS", "FOUND", "{$str}S") );
        !           225: 
        !           226: 
        !           227: echo "\n*** Testing error conditions ***";
        !           228: /* Invalid arguments */
        !           229: var_dump( str_replace() );
        !           230: var_dump( str_replace("") );
        !           231: var_dump( str_replace(NULL) );
        !           232: var_dump( str_replace(1, 2) );
        !           233: var_dump( str_replace(1,2,3,$var,5) );
        !           234: 
        !           235: fclose($resource1);
        !           236: closedir($resource2);
        !           237: echo "Done\n";
        !           238: 
        !           239: ?>
        !           240: --EXPECTF--    
        !           241: *** Testing str_replace() on basic operations ***
        !           242: string(0) ""
        !           243: string(4) "tbst"
        !           244: string(0) ""
        !           245: int(0)
        !           246: string(1) "q"
        !           247: int(1)
        !           248: string(0) ""
        !           249: int(0)
        !           250: string(%d) "Resource id #%d"
        !           251: int(1)
        !           252: 
        !           253: *** Testing str_replace() with various search values ***
        !           254: -- Iteration 0 --
        !           255: array(12) {
        !           256:   [0]=>
        !           257:   string(5) "FOUND"
        !           258:   [1]=>
        !           259:   string(0) ""
        !           260:   [2]=>
        !           261:   string(5) "FOUND"
        !           262:   [3]=>
        !           263:   string(1) "0"
        !           264:   [4]=>
        !           265:   string(6) "-FOUND"
        !           266:   [5]=>
        !           267:   string(5) "FOUND"
        !           268:   [6]=>
        !           269:   string(1) "0"
        !           270:   [7]=>
        !           271:   string(6) "-FOUND"
        !           272:   [8]=>
        !           273:   string(0) ""
        !           274:   [9]=>
        !           275:   array(0) {
        !           276:   }
        !           277:   [10]=>
        !           278:   string(3) "php"
        !           279:   [11]=>
        !           280:   string(0) ""
        !           281: }
        !           282: int(5)
        !           283: 
        !           284: -- Iteration 1 --
        !           285: array(12) {
        !           286:   [0]=>
        !           287:   string(1) "1"
        !           288:   [1]=>
        !           289:   string(0) ""
        !           290:   [2]=>
        !           291:   string(1) "1"
        !           292:   [3]=>
        !           293:   string(1) "0"
        !           294:   [4]=>
        !           295:   string(2) "-1"
        !           296:   [5]=>
        !           297:   string(1) "1"
        !           298:   [6]=>
        !           299:   string(1) "0"
        !           300:   [7]=>
        !           301:   string(2) "-1"
        !           302:   [8]=>
        !           303:   string(0) ""
        !           304:   [9]=>
        !           305:   array(0) {
        !           306:   }
        !           307:   [10]=>
        !           308:   string(3) "php"
        !           309:   [11]=>
        !           310:   string(0) ""
        !           311: }
        !           312: int(0)
        !           313: 
        !           314: -- Iteration 2 --
        !           315: array(12) {
        !           316:   [0]=>
        !           317:   string(5) "FOUND"
        !           318:   [1]=>
        !           319:   string(0) ""
        !           320:   [2]=>
        !           321:   string(5) "FOUND"
        !           322:   [3]=>
        !           323:   string(1) "0"
        !           324:   [4]=>
        !           325:   string(6) "-FOUND"
        !           326:   [5]=>
        !           327:   string(5) "FOUND"
        !           328:   [6]=>
        !           329:   string(1) "0"
        !           330:   [7]=>
        !           331:   string(6) "-FOUND"
        !           332:   [8]=>
        !           333:   string(0) ""
        !           334:   [9]=>
        !           335:   array(0) {
        !           336:   }
        !           337:   [10]=>
        !           338:   string(3) "php"
        !           339:   [11]=>
        !           340:   string(0) ""
        !           341: }
        !           342: int(5)
        !           343: 
        !           344: -- Iteration 3 --
        !           345: array(12) {
        !           346:   [0]=>
        !           347:   string(1) "1"
        !           348:   [1]=>
        !           349:   string(0) ""
        !           350:   [2]=>
        !           351:   string(1) "1"
        !           352:   [3]=>
        !           353:   string(5) "FOUND"
        !           354:   [4]=>
        !           355:   string(2) "-1"
        !           356:   [5]=>
        !           357:   string(1) "1"
        !           358:   [6]=>
        !           359:   string(5) "FOUND"
        !           360:   [7]=>
        !           361:   string(2) "-1"
        !           362:   [8]=>
        !           363:   string(0) ""
        !           364:   [9]=>
        !           365:   array(0) {
        !           366:   }
        !           367:   [10]=>
        !           368:   string(3) "php"
        !           369:   [11]=>
        !           370:   string(0) ""
        !           371: }
        !           372: int(2)
        !           373: 
        !           374: -- Iteration 4 --
        !           375: array(12) {
        !           376:   [0]=>
        !           377:   string(1) "1"
        !           378:   [1]=>
        !           379:   string(0) ""
        !           380:   [2]=>
        !           381:   string(1) "1"
        !           382:   [3]=>
        !           383:   string(1) "0"
        !           384:   [4]=>
        !           385:   string(5) "FOUND"
        !           386:   [5]=>
        !           387:   string(1) "1"
        !           388:   [6]=>
        !           389:   string(1) "0"
        !           390:   [7]=>
        !           391:   string(5) "FOUND"
        !           392:   [8]=>
        !           393:   string(0) ""
        !           394:   [9]=>
        !           395:   array(0) {
        !           396:   }
        !           397:   [10]=>
        !           398:   string(3) "php"
        !           399:   [11]=>
        !           400:   string(0) ""
        !           401: }
        !           402: int(2)
        !           403: 
        !           404: -- Iteration 5 --
        !           405: array(12) {
        !           406:   [0]=>
        !           407:   string(5) "FOUND"
        !           408:   [1]=>
        !           409:   string(0) ""
        !           410:   [2]=>
        !           411:   string(5) "FOUND"
        !           412:   [3]=>
        !           413:   string(1) "0"
        !           414:   [4]=>
        !           415:   string(6) "-FOUND"
        !           416:   [5]=>
        !           417:   string(5) "FOUND"
        !           418:   [6]=>
        !           419:   string(1) "0"
        !           420:   [7]=>
        !           421:   string(6) "-FOUND"
        !           422:   [8]=>
        !           423:   string(0) ""
        !           424:   [9]=>
        !           425:   array(0) {
        !           426:   }
        !           427:   [10]=>
        !           428:   string(3) "php"
        !           429:   [11]=>
        !           430:   string(0) ""
        !           431: }
        !           432: int(5)
        !           433: 
        !           434: -- Iteration 6 --
        !           435: array(12) {
        !           436:   [0]=>
        !           437:   string(1) "1"
        !           438:   [1]=>
        !           439:   string(0) ""
        !           440:   [2]=>
        !           441:   string(1) "1"
        !           442:   [3]=>
        !           443:   string(5) "FOUND"
        !           444:   [4]=>
        !           445:   string(2) "-1"
        !           446:   [5]=>
        !           447:   string(1) "1"
        !           448:   [6]=>
        !           449:   string(5) "FOUND"
        !           450:   [7]=>
        !           451:   string(2) "-1"
        !           452:   [8]=>
        !           453:   string(0) ""
        !           454:   [9]=>
        !           455:   array(0) {
        !           456:   }
        !           457:   [10]=>
        !           458:   string(3) "php"
        !           459:   [11]=>
        !           460:   string(0) ""
        !           461: }
        !           462: int(2)
        !           463: 
        !           464: -- Iteration 7 --
        !           465: array(12) {
        !           466:   [0]=>
        !           467:   string(1) "1"
        !           468:   [1]=>
        !           469:   string(0) ""
        !           470:   [2]=>
        !           471:   string(1) "1"
        !           472:   [3]=>
        !           473:   string(1) "0"
        !           474:   [4]=>
        !           475:   string(5) "FOUND"
        !           476:   [5]=>
        !           477:   string(1) "1"
        !           478:   [6]=>
        !           479:   string(1) "0"
        !           480:   [7]=>
        !           481:   string(5) "FOUND"
        !           482:   [8]=>
        !           483:   string(0) ""
        !           484:   [9]=>
        !           485:   array(0) {
        !           486:   }
        !           487:   [10]=>
        !           488:   string(3) "php"
        !           489:   [11]=>
        !           490:   string(0) ""
        !           491: }
        !           492: int(2)
        !           493: 
        !           494: -- Iteration 8 --
        !           495: array(12) {
        !           496:   [0]=>
        !           497:   string(1) "1"
        !           498:   [1]=>
        !           499:   string(0) ""
        !           500:   [2]=>
        !           501:   string(1) "1"
        !           502:   [3]=>
        !           503:   string(1) "0"
        !           504:   [4]=>
        !           505:   string(2) "-1"
        !           506:   [5]=>
        !           507:   string(1) "1"
        !           508:   [6]=>
        !           509:   string(1) "0"
        !           510:   [7]=>
        !           511:   string(2) "-1"
        !           512:   [8]=>
        !           513:   string(0) ""
        !           514:   [9]=>
        !           515:   array(0) {
        !           516:   }
        !           517:   [10]=>
        !           518:   string(3) "php"
        !           519:   [11]=>
        !           520:   string(0) ""
        !           521: }
        !           522: int(0)
        !           523: 
        !           524: -- Iteration 9 --
        !           525: array(12) {
        !           526:   [0]=>
        !           527:   string(1) "1"
        !           528:   [1]=>
        !           529:   string(0) ""
        !           530:   [2]=>
        !           531:   string(1) "1"
        !           532:   [3]=>
        !           533:   string(1) "0"
        !           534:   [4]=>
        !           535:   string(2) "-1"
        !           536:   [5]=>
        !           537:   string(1) "1"
        !           538:   [6]=>
        !           539:   string(1) "0"
        !           540:   [7]=>
        !           541:   string(2) "-1"
        !           542:   [8]=>
        !           543:   string(0) ""
        !           544:   [9]=>
        !           545:   array(0) {
        !           546:   }
        !           547:   [10]=>
        !           548:   string(3) "php"
        !           549:   [11]=>
        !           550:   string(0) ""
        !           551: }
        !           552: int(0)
        !           553: 
        !           554: -- Iteration 10 --
        !           555: array(12) {
        !           556:   [0]=>
        !           557:   string(1) "1"
        !           558:   [1]=>
        !           559:   string(0) ""
        !           560:   [2]=>
        !           561:   string(1) "1"
        !           562:   [3]=>
        !           563:   string(1) "0"
        !           564:   [4]=>
        !           565:   string(2) "-1"
        !           566:   [5]=>
        !           567:   string(1) "1"
        !           568:   [6]=>
        !           569:   string(1) "0"
        !           570:   [7]=>
        !           571:   string(2) "-1"
        !           572:   [8]=>
        !           573:   string(0) ""
        !           574:   [9]=>
        !           575:   array(0) {
        !           576:   }
        !           577:   [10]=>
        !           578:   string(5) "FOUND"
        !           579:   [11]=>
        !           580:   string(0) ""
        !           581: }
        !           582: int(1)
        !           583: 
        !           584: -- Iteration 11 --
        !           585: array(12) {
        !           586:   [0]=>
        !           587:   string(1) "1"
        !           588:   [1]=>
        !           589:   string(0) ""
        !           590:   [2]=>
        !           591:   string(1) "1"
        !           592:   [3]=>
        !           593:   string(1) "0"
        !           594:   [4]=>
        !           595:   string(2) "-1"
        !           596:   [5]=>
        !           597:   string(1) "1"
        !           598:   [6]=>
        !           599:   string(1) "0"
        !           600:   [7]=>
        !           601:   string(2) "-1"
        !           602:   [8]=>
        !           603:   string(0) ""
        !           604:   [9]=>
        !           605:   array(0) {
        !           606:   }
        !           607:   [10]=>
        !           608:   string(3) "php"
        !           609:   [11]=>
        !           610:   string(0) ""
        !           611: }
        !           612: int(0)
        !           613: 
        !           614: *** Testing str_replace() with various subjects ***
        !           615: --- Iteration 0 ---
        !           616: -- String after replacing the search value is => --
        !           617: string(177) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           618:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!FOUND 
        !           619:            ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           620: -- search string has found '2' times
        !           621: 
        !           622: --- Iteration 1 ---
        !           623: -- String after replacing the search value is => --
        !           624: string(177) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           625:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!FOUND 
        !           626:            ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           627: -- search string has found '2' times
        !           628: 
        !           629: --- Iteration 2 ---
        !           630: -- String after replacing the search value is => --
        !           631: string(182) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           632:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: FOUND 
        !           633:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           634: -- search string has found '1' times
        !           635: 
        !           636: --- Iteration 3 ---
        !           637: -- String after replacing the search value is => --
        !           638: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           639:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           640:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           641: -- search string has found '0' times
        !           642: 
        !           643: --- Iteration 4 ---
        !           644: -- String after replacing the search value is => --
        !           645: string(182) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           646:            0«CDabcd \xXYZ    abcd $FOUND: !!Hello, World 
        !           647:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           648: -- search string has found '1' times
        !           649: 
        !           650: --- Iteration 5 ---
        !           651: -- String after replacing the search value is => --
        !           652: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           653:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           654:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           655: -- search string has found '0' times
        !           656: 
        !           657: --- Iteration 6 ---
        !           658: -- String after replacing the search value is => --
        !           659: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           660:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           661:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           662: -- search string has found '0' times
        !           663: 
        !           664: --- Iteration 7 ---
        !           665: -- String after replacing the search value is => --
        !           666: string(189) "Hello, world,0120333.3445FOUND67          NULL TRUE FALSE
        !           667:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           668:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           669: -- search string has found '1' times
        !           670: 
        !           671: --- Iteration 8 ---
        !           672: -- String after replacing the search value is => --
        !           673: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           674:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           675:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           676: -- search string has found '0' times
        !           677: 
        !           678: --- Iteration 9 ---
        !           679: -- String after replacing the search value is => --
        !           680: string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           681:            0«CDFOUND \xXYZ   FOUND $$@#%^&*!~,.:;?: !!Hello, World 
        !           682:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           683: -- search string has found '2' times
        !           684: 
        !           685: --- Iteration 10 ---
        !           686: -- String after replacing the search value is => --
        !           687: string(193) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           688:            0«CDabcd \xFOUND  abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           689:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           690: -- search string has found '1' times
        !           691: 
        !           692: --- Iteration 11 ---
        !           693: -- String after replacing the search value is => --
        !           694: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           695:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           696:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           697: -- search string has found '0' times
        !           698: 
        !           699: --- Iteration 12 ---
        !           700: -- String after replacing the search value is => --
        !           701: string(192) "Hello, world,0120333.3445-1.234567          FOUND TRUE FALSE
        !           702:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           703:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           704: -- search string has found '1' times
        !           705: 
        !           706: --- Iteration 13 ---
        !           707: -- String after replacing the search value is => --
        !           708: string(207) "Hello, world,FOUND12FOUND333.3445-1.234567          NULL TRUE FALSE
        !           709:            FOUND«CDabcd \xXYZ        abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           710:            ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           711: -- search string has found '4' times
        !           712: 
        !           713: --- Iteration 14 ---
        !           714: -- String after replacing the search value is => --
        !           715: string(207) "Hello, world,FOUND12FOUND333.3445-1.234567          NULL TRUE FALSE
        !           716:            FOUND«CDabcd \xXYZ        abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           717:            ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           718: -- search string has found '4' times
        !           719: 
        !           720: --- Iteration 15 ---
        !           721: -- String after replacing the search value is => --
        !           722: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           723:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           724:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           725: -- search string has found '0' times
        !           726: 
        !           727: --- Iteration 16 ---
        !           728: -- String after replacing the search value is => --
        !           729: string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
        !           730: FOUND  FOUNDFOUNDFOUNDFOUND0«CDabcdFOUND\xXYZ        abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorldFOUND
        !           731:        FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           732: -- search string has found '29' times
        !           733: 
        !           734: --- Iteration 17 ---
        !           735: -- String after replacing the search value is => --
        !           736: string(203) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSEFOUND
        !           737:            FOUND0«CDFOUNDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           738:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           739: -- search string has found '3' times
        !           740: 
        !           741: --- Iteration 18 ---
        !           742: -- String after replacing the search value is => --
        !           743: string(194) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           744:            FOUND«CDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           745:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           746: -- search string has found '1' times
        !           747: 
        !           748: --- Iteration 19 ---
        !           749: -- String after replacing the search value is => --
        !           750: string(194) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           751:            0FOUNDDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           752:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           753: -- search string has found '1' times
        !           754: 
        !           755: --- Iteration 20 ---
        !           756: -- String after replacing the search value is => --
        !           757: string(194) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           758:            FOUND«CDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           759:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           760: -- search string has found '1' times
        !           761: 
        !           762: --- Iteration 21 ---
        !           763: -- String after replacing the search value is => --
        !           764: string(194) "Hello, world,0120333FOUND445-1.234567          NULL TRUE FALSE
        !           765:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           766:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           767: -- search string has found '1' times
        !           768: 
        !           769: --- Iteration 22 ---
        !           770: -- String after replacing the search value is => --
        !           771: string(203) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE
        !           772:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           773:            ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
        !           774: -- search string has found '3' times
        !           775: 
        !           776: --- Iteration 23 ---
        !           777: -- String after replacing the search value is => --
        !           778: string(192) "Hello, world,0120333.3445-1.234567          NULL FOUND FALSE
        !           779:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           780:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           781: -- search string has found '1' times
        !           782: 
        !           783: --- Iteration 24 ---
        !           784: -- String after replacing the search value is => --
        !           785: string(203) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE
        !           786:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           787:            ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
        !           788: -- search string has found '3' times
        !           789: 
        !           790: --- Iteration 25 ---
        !           791: -- String after replacing the search value is => --
        !           792: string(203) "Hello, world,0FOUND20333.3445-FOUND.234567          NULL TRUE FALSE
        !           793:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           794:            ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
        !           795: -- search string has found '3' times
        !           796: 
        !           797: --- Iteration 26 ---
        !           798: -- String after replacing the search value is => --
        !           799: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           800:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           801:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           802: -- search string has found '0' times
        !           803: 
        !           804: --- Iteration 27 ---
        !           805: -- String after replacing the search value is => --
        !           806: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FOUND
        !           807:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           808:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           809: -- search string has found '1' times
        !           810: 
        !           811: --- Iteration 28 ---
        !           812: -- String after replacing the search value is => --
        !           813: string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
        !           814: FOUND  FOUNDFOUNDFOUNDFOUND0«CDabcdFOUND\xXYZ        abcdFOUND$$@#%^&*!~,.:;?:FOUND!!Hello,FOUNDWorldFOUND
        !           815:        FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           816: -- search string has found '29' times
        !           817: 
        !           818: --- Iteration 29 ---
        !           819: -- String after replacing the search value is => --
        !           820: string(186) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE
        !           821:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           822:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           823: -- search string has found '1' times
        !           824: 
        !           825: --- Iteration 30 ---
        !           826: -- String after replacing the search value is => --
        !           827: string(199) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           828:            0«CDaFOUNDcd \xXYZ        aFOUNDcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           829:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           830: -- search string has found '2' times
        !           831: 
        !           832: --- Iteration 31 ---
        !           833: -- String after replacing the search value is => --
        !           834: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           835:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           836:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           837: -- search string has found '0' times
        !           838: 
        !           839: --- Iteration 32 ---
        !           840: -- String after replacing the search value is => --
        !           841: string(203) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           842:  FOUND    0«CDabcd \xXYZFOUNDabcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           843: FOUND    ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           844: -- search string has found '3' times
        !           845: 
        !           846: --- Iteration 33 ---
        !           847: -- String after replacing the search value is => --
        !           848: string(191) "Hello, world,0120333.3445-1.234567          NULL TRUE FALSE
        !           849:            0«CDabcd \xXYZ    abcd $$@#%^&*!~,.:;?: !!Hello, World 
        !           850:            ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
        !           851: -- search string has found '0' times
        !           852: 
        !           853: --- Iteration 34 ---
        !           854: -- String after replacing the search value is => --
        !           855: string(5) "FOUND"
        !           856: -- search string has found '1' times
        !           857: 
        !           858: *** Testing Miscelleneous input data ***
        !           859: string(3) "qqq"
        !           860: int(5)
        !           861: array(3) {
        !           862:   [0]=>
        !           863:   string(3) "qqq"
        !           864:   [1]=>
        !           865:   string(0) ""
        !           866:   [2]=>
        !           867:   string(3) "ccc"
        !           868: }
        !           869: int(6)
        !           870: 
        !           871: -- Testing objects --
        !           872: string(12) "Hello, world"
        !           873: int(1)
        !           874: 
        !           875: -- Testing arrays --
        !           876: string(15) "multimultimulti"
        !           877: int(3)
        !           878: string(3) "qqq"
        !           879: int(3)
        !           880: array(2) {
        !           881:   [0]=>
        !           882:   string(3) "qqq"
        !           883:   [1]=>
        !           884:   string(3) "ccc"
        !           885: }
        !           886: int(6)
        !           887: 
        !           888: Notice: Array to string conversion in %s on line %d
        !           889: array(2) {
        !           890:   [0]=>
        !           891:   string(15) "ArrayArrayArray"
        !           892:   [1]=>
        !           893:   string(3) "bbb"
        !           894: }
        !           895: int(3)
        !           896: array(2) {
        !           897:   [0]=>
        !           898:   string(3) "111"
        !           899:   [1]=>
        !           900:   string(3) "bbb"
        !           901: }
        !           902: int(3)
        !           903: array(2) {
        !           904:   [0]=>
        !           905:   string(4) "aaa3"
        !           906:   [1]=>
        !           907:   string(4) "2bbb"
        !           908: }
        !           909: int(1)
        !           910: 
        !           911: -- Testing Resources --
        !           912: string(%d) "Resource id #%d"
        !           913: int(0)
        !           914: string(%d) "Resource id #%d"
        !           915: int(0)
        !           916: 
        !           917: -- Testing a longer and heredoc string --
        !           918: string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           919: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           920: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           921: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           922: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           923: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           924: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
        !           925: @#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
        !           926: FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789"
        !           927: int(16)
        !           928: 
        !           929: -- Testing a heredoc null string --
        !           930: string(0) ""
        !           931: int(0)
        !           932: 
        !           933: -- Testing simple and complex syntax strings --
        !           934: string(5) "FOUND"
        !           935: string(5) "FOUND"
        !           936: 
        !           937: Notice: Undefined variable: strS in %s on line %d
        !           938: string(0) ""
        !           939: string(5) "FOUND"
        !           940: string(5) "FOUND"
        !           941: 
        !           942: *** Testing error conditions ***
        !           943: Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d
        !           944: NULL
        !           945: 
        !           946: Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
        !           947: NULL
        !           948: 
        !           949: Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
        !           950: NULL
        !           951: 
        !           952: Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d
        !           953: NULL
        !           954: 
        !           955: Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d
        !           956: NULL
        !           957: Done

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