1--TEST-- 2mb_strstr() 3--SKIPIF-- 4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> 5--INI-- 6mbstring.internal_encoding=UTF-8 7--FILE-- 8<?php 9function EUC_JP($utf8str) { 10 return mb_convert_encoding($utf8str, "EUC-JP", "UTF-8"); 11} 12 13function FROM_EUC_JP($eucjpstr) { 14 return mb_convert_encoding($eucjpstr, "UTF-8", "EUC-JP"); 15} 16 17var_dump(mb_strstr("あいうえおかきくけこ", "おかき")); 18var_dump(mb_strstr("あいうえおかきくけこ", "おかき", false)); 19var_dump(mb_strstr("あいうえおかきくけこ", "おかき", true)); 20var_dump(FROM_EUC_JP(mb_strstr(EUC_JP("あいうえおかきくけこ"), EUC_JP("おかき"), false, "EUC-JP"))); 21var_dump(FROM_EUC_JP(mb_strstr(EUC_JP("あいうえおかきくけこ"), EUC_JP("おかき"), true, "EUC-JP"))); 22mb_internal_encoding("EUC-JP"); 23var_dump(FROM_EUC_JP(mb_strstr(EUC_JP("あいうえおかきくけこ"), EUC_JP("おかき")))); 24var_dump(FROM_EUC_JP(mb_strstr(EUC_JP("あいうえおかきくけこ"), EUC_JP("おかき"), false))); 25var_dump(FROM_EUC_JP(mb_strstr(EUC_JP("あいうえおかきくけこ"), EUC_JP("おかき"), true))); 26?> 27--EXPECT-- 28string(18) "おかきくけこ" 29string(18) "おかきくけこ" 30string(12) "あいうえ" 31string(18) "おかきくけこ" 32string(12) "あいうえ" 33string(18) "おかきくけこ" 34string(18) "おかきくけこ" 35string(12) "あいうえ" 36