1--TEST-- 2Test mb_strstr() function : with empty needle 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build"); 7?> 8--FILE-- 9<?php 10 11mb_internal_encoding('UTF-8'); 12 13$string_ascii = 'abc def'; 14// Japanese string in UTF-8 15$string_mb = "日本語テキストです。0123456789。"; 16 17echo "\n-- ASCII string --\n"; 18var_dump(mb_strstr($string_ascii, '', false, 'ISO-8859-1')); 19var_dump(mb_strstr($string_ascii, '')); 20var_dump(mb_strstr($string_ascii, '', true)); 21 22echo "\n-- Multibyte string --\n"; 23var_dump(mb_strstr($string_mb, '')); 24var_dump(mb_strstr($string_mb, '', false, 'utf-8')); 25var_dump(mb_strstr($string_mb, '', true)); 26 27?> 28--EXPECT-- 29-- ASCII string -- 30string(7) "abc def" 31string(7) "abc def" 32string(0) "" 33 34-- Multibyte string -- 35string(53) "日本語テキストです。0123456789。" 36string(53) "日本語テキストです。0123456789。" 37string(0) "" 38