xref: /PHP-5.5/ext/mbstring/tests/mb_strcut.phpt (revision 85d77510)
1--TEST--
2mb_strcut()
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 encodings
10ini_set('include_path', dirname(__FILE__));
11include_once('common.inc');
12
13// EUC-JP
14$euc_jp = '0123����ʸ��������ܸ�Ǥ���EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ�����';
15
16print  mb_strcut($euc_jp,  6,   5,'EUC-JP') . "\n";
17print  mb_strcut($euc_jp,  0, 100,'EUC-JP') . "\n";
18
19$str = mb_strcut($euc_jp, 100, 10,'EUC-JP');
20($str === false) ? print "OK\n" : print "NG: $str\n";
21
22$str = mb_strcut($euc_jp, -100, 10,'EUC-JP');
23($str !== "") ?	print "OK: $str\n" : print "NG:\n";
24
25
26?>
27
28--EXPECT--
29��ʸ
300123����ʸ��������ܸ�Ǥ���EUC-JP��ȤäƤ��ޤ������ܸ�����ݽ�����
31OK
32OK: 0123����ʸ
33
34
35