1--TEST--
2Test iconv_strlen() function : basic functionality
3--SKIPIF--
4<?php
5extension_loaded('iconv') or die('skip');
6function_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
19echo "*** 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
25echo "\n-- ASCII String --\n";
26var_dump(iconv_strlen($string_ascii));
27
28echo "\n-- Multibyte String --\n";
29var_dump(iconv_strlen($string_mb, 'UTF-8'));
30?>
31===DONE===
32--EXPECTF--
33*** Testing iconv_strlen() : basic functionality***
34
35-- ASCII String --
36int(7)
37
38-- Multibyte String --
39int(21)
40===DONE===
41