str_split是一個函式。str_split() 函式把字元串分割到數組中。
基本介紹
- 中文名:str_split
- 外文名:str_split
- 語法:str_split(string,length)
- string:必需。規定要分割的字元串。
參數描述
string | 必需。規定要分割的字元串。 |
length | 可選。規定每個數組元素的長度。默認是 1。 |
使用說明
套用舉例
示例1
<?php print_r(str_split("Hello")); ?> |
Array ( [0] => H [1] => e [2] => l [3] => l [4] => o ) |
示例2
<?php print_r(str_split("Hello",3)); ?> |
Array ( [0] => Hel [1] => lo ) |