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