mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
a06d015e61
These functions are always available (if the extension is available at all).
35 lines
858 B
PHP
35 lines
858 B
PHP
--TEST--
|
||
Test mb_strstr() function : with empty needle
|
||
--EXTENSIONS--
|
||
mbstring
|
||
--FILE--
|
||
<?php
|
||
|
||
mb_internal_encoding('UTF-8');
|
||
|
||
$string_ascii = 'abc def';
|
||
// Japanese string in UTF-8
|
||
$string_mb = "日本語テキストです。0123456789。";
|
||
|
||
echo "\n-- ASCII string --\n";
|
||
var_dump(mb_strstr($string_ascii, '', false, 'ISO-8859-1'));
|
||
var_dump(mb_strstr($string_ascii, ''));
|
||
var_dump(mb_strstr($string_ascii, '', true));
|
||
|
||
echo "\n-- Multibyte string --\n";
|
||
var_dump(mb_strstr($string_mb, ''));
|
||
var_dump(mb_strstr($string_mb, '', false, 'utf-8'));
|
||
var_dump(mb_strstr($string_mb, '', true));
|
||
|
||
?>
|
||
--EXPECT--
|
||
-- ASCII string --
|
||
string(7) "abc def"
|
||
string(7) "abc def"
|
||
string(0) ""
|
||
|
||
-- Multibyte string --
|
||
string(53) "日本語テキストです。0123456789。"
|
||
string(53) "日本語テキストです。0123456789。"
|
||
string(0) ""
|