PHP – mb_split(多字节拆分)函数
mb_split()PHP中的函数用于使用正则表达式拆分多字节字符串。它以数组格式返回结果。
语法
array mb_split($str_pattern, $str_string, int $limit=-1)
参数
mb_split()接受以下三个参数-
$str_pattern-用于正则表达式的模式。
$str_string-用于拆分字符串。
$limit-它是一个可选参数,用于指定限制元素。
返回值
该mb_split函数将返回分割元件导致成阵列。或者,它会在失败时返回False。
示例1
<?php
mb_internal_encoding("UTF-8");
//mb_split函数将分割字符串
$string = mb_split(
"[ ,]+", //图案
"Welcome to the PHP Tutorial"); //细绳
print_r($string);
?>输出结果它将产生以下输出-
Array ( [0] => Welcome [1] => to [2] => the [3] => PHP [4] => Tutorial )
热门推荐
10 祝孙辈生日祝福语简短
11 恋人跨年祝福语大全简短
12 考大学敬酒简短祝福语
13 开工投产大吉祝福语 简短
14 偶然结婚祝福语朋友简短
15 感谢学长学姐祝福语简短
16 戏精的祝福语简短
17 我要结婚祝福语简短
18 婚前女儿生日祝福语简短