Annotation of embedaddon/php/ext/iconv/tests/iconv_strlen_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test iconv_strlen() function : basic functionality
                      3: --SKIPIF--
                      4: <?php
                      5: extension_loaded('iconv') or die('skip');
                      6: function_exists('iconv_strlen') or die("skip iconv_strlen() is not available in this build");
                      7: ?>
                      8: --FILE--
                      9: <?php
                     10: /* Prototype  : int iconv_strlen(string str [, string charset])
                     11:  * Description: Get character numbers of a string 
                     12:  * Source code: ext/iconv/iconv.c
                     13:  */
                     14: 
                     15: /*
                     16:  * Test basic functionality of iconv_strlen()
                     17:  */
                     18: 
                     19: echo "*** Testing iconv_strlen() : basic functionality***\n";
                     20: 
                     21: $string_ascii = b'abc def';
                     22: //Japanese string in UTF-8
                     23: $string_mb = base64_decode(b'5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
                     24: 
                     25: echo "\n-- ASCII String --\n";
                     26: var_dump(iconv_strlen($string_ascii));
                     27: 
                     28: echo "\n-- Multibyte String --\n";
                     29: var_dump(iconv_strlen($string_mb, 'UTF-8'));
                     30: ?>
                     31: ===DONE===
                     32: --EXPECTF--
                     33: *** Testing iconv_strlen() : basic functionality***
                     34: 
                     35: -- ASCII String --
                     36: int(7)
                     37: 
                     38: -- Multibyte String --
                     39: int(21)
                     40: ===DONE===

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