TA的每日心情 | 汗 2024-10-15 10:05 |
---|
签到天数: 372 天 [LV.9]以坛为家II
|
使用exploder()函数,explode(string $delimiter, string $string),
第一个参数为分割依据,即按照什么格式分割字符串
第二个参数为分割对象,即为需要分割的字符串变量
返回值为分割好的数组
1、字符串:$str = "Hello world. It's a beautiful day.";
2、$strArray = explode(@" ", $str);
3、print_r (strArray);
strArray(
[0] => Hello
[1] => world.
[2] => It's
[3] => a
[4] => beautiful
[5] => day.
) |
|