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 "String width: ".mb_strwidth($euc_jp,'EUC-JP')."\n"; 18 19print "1: ". mb_strimwidth($euc_jp, 0, 15,'...','EUC-JP') . "\n"; 20print "2: ". mb_strimwidth($euc_jp, 0, 100,'...','EUC-JP') . "\n"; 21print "3: ". mb_strimwidth($euc_jp, 15, 100,'...','EUC-JP') . "\n"; 22print "4: ". mb_strimwidth($euc_jp, -30, 5,'...','EUC-JP') . "\n"; 23print "5: ". mb_strimwidth($euc_jp, 38, 5,'...','EUC-JP') . "\n"; 24print "6: ". mb_strimwidth($euc_jp, 38, -25,'...','EUC-JP') . "\n"; 25print "7: ". mb_strimwidth($euc_jp, -30, -25,'...','EUC-JP') . "\n"; 26 27$str = mb_strimwidth($euc_jp, 0, -100,'...','EUC-JP'); 28($str === FALSE) ? print "10 OK\n" : print "NG: $str\n"; 29 30$str = mb_strimwidth($euc_jp, 100, 10,'...','EUC-JP'); 31($str === FALSE) ? print "11 OK\n" : print "NG: $str\n"; 32 33$str = mb_strimwidth($euc_jp, -100, 10,'...','EUC-JP'); 34($str === FALSE) ? print "12 OK\n" : print "NG: $str\n"; 35 36$str = mb_strimwidth($euc_jp, -10, -12,'...','EUC-JP'); 37($str === FALSE) ? print "13 OK\n" : print "NG: $str\n"; 38 39?> 40--EXPECT-- 41String width: 68 421: 0123����ʸ��... 432: 0123����ʸ��������ܸ�Ǥ���EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ����� 443: ��EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ����� 454: �� 465: �� 476: �� 487: �� 49ERR: Warning 5010 OK 51ERR: Warning 5211 OK 53ERR: Warning 5412 OK 55ERR: Warning 5613 OK 57