File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / mbstring / tests / mb_strcut.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:57 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
mb_strcut()
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
output_handler=
--FILE--
<?php
// TODO: Add more encodings
ini_set('include_path', dirname(__FILE__));
include_once('common.inc');

// EUC-JP
$euc_jp = '0123この文字列は日本語です。EUC-JPを使っています。日本語は面倒臭い。';

print  mb_strcut($euc_jp,  6,   5,'EUC-JP') . "\n";
print  mb_strcut($euc_jp,  0, 100,'EUC-JP') . "\n";

$str = mb_strcut($euc_jp, 100, 10,'EUC-JP');
($str === false) ? print "OK\n" : print "NG: $str\n";

$str = mb_strcut($euc_jp, -100, 10,'EUC-JP');
($str !== "") ?	print "OK: $str\n" : print "NG:\n";


?>

--EXPECT--
の文
0123この文字列は日本語です。EUC-JPを使っています。日本語は面倒臭い。
OK
OK: 0123この文



FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>