Annotation of embedaddon/php/ext/mbstring/tests/mb_substr_count_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test mb_substr_count() function : basic functionality
        !             3: --SKIPIF--
        !             4: <?php
        !             5: extension_loaded('mbstring') or die('skip');
        !             6: function_exists('mb_substr_count') or die("skip mb_substr_count() is not available in this build");
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: /* Prototype  : int mb_substr_count(string $haystack, string $needle [, string $encoding])
        !            11:  * Description: Count the number of substring occurrences 
        !            12:  * Source code: ext/mbstring/mbstring.c
        !            13:  */
        !            14: 
        !            15: /*
        !            16:  * Test Basic functionality of mb_substr_count
        !            17:  */
        !            18: 
        !            19: echo "*** Testing mb_substr_count() : basic functionality ***\n";
        !            20: 
        !            21: $string_ascii = 'This is an English string. 0123456789.';
        !            22: 
        !            23: $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
        !            24: $needle_mb1 = base64_decode('44CC');
        !            25: $needle_mb2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
        !            26: 
        !            27: echo "\n-- ASCII String --\n";
        !            28: var_dump(mb_substr_count($string_ascii, 'is'));
        !            29: var_dump(mb_substr_count($string_ascii, 'hello, world'));
        !            30: 
        !            31: echo "\n-- Multibyte String --\n";
        !            32: var_dump(mb_substr_count($string_mb, $needle_mb1));
        !            33: var_dump(mb_substr_count($string_mb, $needle_mb2));
        !            34: 
        !            35: echo "Done";
        !            36: ?>
        !            37: --EXPECTF--
        !            38: *** Testing mb_substr_count() : basic functionality ***
        !            39: 
        !            40: -- ASCII String --
        !            41: int(3)
        !            42: int(0)
        !            43: 
        !            44: -- Multibyte String --
        !            45: int(2)
        !            46: int(0)
        !            47: Done

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