Split the string "Hello" into an array:
<?phpprint_r(str_split("Hello"));?>The str_split() function splits a string into an array.
str_split( string,length )
| parameter | describe |
|---|---|
| string | Required. Specifies the string to be split. |
| length | Optional. Specifies the length of each array element. The default is 1. |
| Return value: | If length is less than 1, the str_split() function returns FALSE. If length is greater than the length of the string, the entire string is returned as the only element of the array. |
|---|---|
| PHP version: | 5+ |
Use the length parameter:
<?phpprint_r(str_split("Hello",3));?>