php IHDR w Q )Ba pHYs sRGB gAMA a IDATxMk\U s&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨ G;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j- $_q?qS XzG'ay
files >> /opt/php-7.0.1/ext/mbstring/tests/ |
files >> //opt/php-7.0.1/ext/mbstring/tests/mb_strlen.phpt |
--TEST-- mb_strlen() --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --INI-- mbstring.func_overload=0 --FILE-- <?php // TODO: Add more encodings //$debug=true; ini_set('include_path', dirname(__FILE__)); include_once('common.inc'); // restore detect_order to 'auto' mb_detect_order('auto'); // Test string $euc_jp = '0123ʸܸǤEUC-JPȤäƤޤ0123ܸݽ'; $ascii = 'abcdefghijklmnopqrstuvwxyz;]=#0123456789'; // ASCII echo "== ASCII ==\n"; print mb_strlen($ascii,'ASCII') . "\n"; print strlen($ascii) . "\n"; // EUC-JP echo "== EUC-JP ==\n"; print mb_strlen($euc_jp,'EUC-JP') . "\n"; mb_internal_encoding('EUC-JP') or print("mb_internal_encoding() failed\n"); print strlen($euc_jp) . "\n"; // SJIS echo "== SJIS ==\n"; $sjis = mb_convert_encoding($euc_jp, 'SJIS','EUC-JP'); print mb_strlen($sjis,'SJIS') . "\n"; mb_internal_encoding('SJIS') or print("mb_internal_encoding() failed\n"); print strlen($sjis) . "\n"; // JIS // Note: either convert_encoding or strlen has problem echo "== JIS ==\n"; $jis = mb_convert_encoding($euc_jp, 'JIS','EUC-JP'); print mb_strlen($jis,'JIS') . "\n"; mb_internal_encoding('JIS') or print("mb_internal_encoding() failed\n"); print strlen($jis) . "\n"; // UTF-8 // Note: either convert_encoding or strlen has problem echo "== UTF-8 ==\n"; $utf8 = mb_convert_encoding($euc_jp, 'UTF-8','EUC-JP'); print mb_strlen($utf8,'UTF-8') . "\n"; mb_internal_encoding('UTF-8') or print("mb_internal_encoding() failed\n"); print strlen($utf8) . "\n"; // Wrong Parameters echo "== WRONG PARAMETERS ==\n"; // Array // Note: PHP Warning, strlen() expects parameter 1 to be string, array given $r = strlen($t_ary); echo $r."\n"; // Object // Note: PHP Warning, strlen() expects parameter 1 to be string, object given $r = strlen($t_obj); echo $r."\n"; // Wrong encoding mb_internal_encoding('EUC-JP'); $r = mb_strlen($euc_jp, 'BAD_NAME'); echo $r."\n"; ?> --EXPECT-- == ASCII == 40 40 == EUC-JP == 43 72 == SJIS == 43 72 == JIS == 43 90 == UTF-8 == 43 101 == WRONG PARAMETERS == ERR: Warning ERR: Warning ERR: Warningy~or5J={Eeu磝Qk ᯘG{?+]ן?wM3X^歌>{7پK>on\jy Rg/=fOroNVv~Y+ NGuÝHWyw[eQʨSb> >}Gmx[o[<{Ϯ_qFvM IENDB`