Split the string "Hello" into an array:
<?php
print_r(str_split("Hello"));
?>
Try it Yourself »
The str_split() function splits a string into an array.
str_split(
string,length)
Parameter | Description |
---|---|
string | Required. Specifies the string to split |
length | Optional. Specifies the length of each array element. Default is 1 |
Return Value: | If length is less than 1, the str_split() function will return FALSE. If length is larger than the length of string, the entire string will be returned as the only element of the array. |
---|---|
PHP Version: | 5+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!