1--TEST--
2mb_strimwidth()
3--SKIPIF--
4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5--INI--
6output_handler=
7--FILE--
8<?php
9// TODO: Add more encoding
10//$debug = true;
11ini_set('include_path', dirname(__FILE__));
12include_once('common.inc');
13
14// EUC-JP
15$euc_jp = '0123����ʸ��������ܸ�Ǥ���EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ�����';
16
17print  "1: ". mb_strimwidth($euc_jp,  0, 15,'...','EUC-JP') . "\n";
18print  "2: ". mb_strimwidth($euc_jp,  0, 100,'...','EUC-JP') . "\n";
19print  "3: ". mb_strimwidth($euc_jp, 15, 100,'...','EUC-JP') . "\n";
20// Note: Did not start form -22 offset. Staring from 0.
21$str = mb_strimwidth($euc_jp,-22, 100,'...','EUC-JP');
22($str === FALSE) ? print "4 OK\n" : print "NG: $str\n";
23
24$str = mb_strimwidth($euc_jp, 100, -10,'...','EUC-JP');
25($str === FALSE) ? print "5 OK\n" : print "NG: $str\n";
26
27$str = mb_strimwidth($euc_jp, -100, 10,'...','EUC-JP');
28($str === FALSE) ? print "6 OK\n" : print "NG: $str\n";
29
30?>
31
32--EXPECT--
331: 0123����ʸ��...
342: 0123����ʸ��������ܸ�Ǥ���EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ�����
353: ��EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ�����
36ERR: Warning
374 OK
38ERR: Warning
395 OK
40ERR: Warning
416 OK
42
43
44