The str_split() function splits the string into an array
Syntax
str_split(string,length)
Example
Output
Array([0]=>h
[1]=>e
[2]=>l
[3]=>l
[4]=>o
)
Array([0]=>he
[1]=>ll
[2]=>o)
Syntax
str_split(string,length)
Example
<?php // split the string into an array print_r(str_split("hello")); print_r(str_split("hello",2)); ?> |
Array([0]=>h
[1]=>e
[2]=>l
[3]=>l
[4]=>o
)
Array([0]=>he
[1]=>ll
[2]=>o)
0 comments:
Post a Comment