xref: /PHP-7.3/ext/mbstring/tests/mb_strwidth.phpt (revision b746e698)
1--TEST--
2mb_strwidth()
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5--FILE--
6<?php
7// TODO: Add more encoding, strings.....
8//$debug = true;
9ini_set('include_path', dirname(__FILE__));
10include_once('common.inc');
11
12// EUC-JP
13$euc_jp = '0123����ʸ��������ܸ�Ǥ���EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ�����';
14
15print  "1: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
16/*
17
18print  "2: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
19print  "3: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
20// Note: Did not start form -22 offset. Staring from 0.
21print  "4: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
22
23$str = mb_strwidth($euc_jp, 100, -10,'...','EUC-JP');
24($str === "") ? print "5 OK\n" : print "NG: $str\n";
25
26$str = mb_strwidth($euc_jp, -100, 10,'...','EUC-JP');
27($str !== "") ?	print "6 OK: $str\n" : print "NG: $str\n";
28*/
29?>
30--EXPECT--
311: 68
32