summaryrefslogtreecommitdiff
path: root/ext/iconv/tests/iconv_strlen_basic.phpt
blob: e5d6271f69aac1e605a096f372c22fd6fe816476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--TEST--
Test iconv_strlen() function : basic functionality
--SKIPIF--
<?php
extension_loaded('iconv') or die('skip');
function_exists('iconv_strlen') or die("skip iconv_strlen() is not available in this build");
?>
--FILE--
<?php
/* Prototype  : int iconv_strlen(string str [, string charset])
 * Description: Get character numbers of a string 
 * Source code: ext/iconv/iconv.c
 */

/*
 * Test basic functionality of iconv_strlen()
 */

echo "*** Testing iconv_strlen() : basic functionality***\n";

$string_ascii = 'abc def';
//Japanese string in UTF-8
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');

echo "\n-- ASCII String --\n";
var_dump(iconv_strlen($string_ascii));

echo "\n-- Multibyte String --\n";
var_dump(iconv_strlen($string_mb, 'UTF-8'));
?>
===DONE===
--EXPECTF--
*** Testing iconv_strlen() : basic functionality***

-- ASCII String --
int(7)

-- Multibyte String --
int(21)
===DONE===