Annotation of embedaddon/php/ext/iconv/tests/iconv_strrpos_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test iconv_strrpos() function : basic functionality
        !             3: --SKIPIF--
        !             4: <?php
        !             5: extension_loaded('iconv') or die('skip');
        !             6: function_exists('iconv_strrpos') or die("skip iconv_strrpos() is not available in this build");
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10: /* Prototype  : proto int iconv_strrpos(string haystack, string needle [, string charset])
        !            11:  * Description: Find position of last occurrence of a string within another 
        !            12:  * Source code: ext/iconv/iconv.c
        !            13:  */
        !            14: 
        !            15: /*
        !            16:  * Test basic functionality of iconv_strrpos()
        !            17:  */
        !            18: 
        !            19: echo "*** Testing iconv_strrpos() : basic ***\n";
        !            20: 
        !            21: iconv_set_encoding("internal_encoding", "UTF-8");
        !            22: 
        !            23: $string_ascii = b'This is an English string. 0123456789.';
        !            24: //Japanese string in UTF-8
        !            25: $string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
        !            26: 
        !            27: echo "\n-- ASCII string 1 --\n";
        !            28: var_dump(iconv_strrpos($string_ascii, b'is', 'ISO-8859-1'));
        !            29: 
        !            30: echo "\n-- ASCII string 2 --\n";
        !            31: var_dump(iconv_strrpos($string_ascii, b'hello, world'));
        !            32: 
        !            33: echo "\n-- Multibyte string 1 --\n";
        !            34: $needle1 = base64_decode(b'44CC');
        !            35: var_dump(iconv_strrpos($string_mb, $needle1));
        !            36: 
        !            37: echo "\n-- Multibyte string 2 --\n";
        !            38: $needle2 = base64_decode(b'44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
        !            39: var_dump(iconv_strrpos($string_mb, $needle2));
        !            40: 
        !            41: echo "Done";
        !            42: ?>
        !            43: --EXPECTF--
        !            44: *** Testing iconv_strrpos() : basic ***
        !            45: 
        !            46: -- ASCII string 1 --
        !            47: int(15)
        !            48: 
        !            49: -- ASCII string 2 --
        !            50: bool(false)
        !            51: 
        !            52: -- Multibyte string 1 --
        !            53: int(20)
        !            54: 
        !            55: -- Multibyte string 2 --
        !            56: bool(false)
        !            57: Done
        !            58: 

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