|
|
Tutorials » Php »
|
Topic |
What is str_split Function?
|
|
Explanation |
|
In PHP, this function is used to convert a string to an array.
Syntax:
str_split(string,length)
In the above syntax "string" specified is converted to an array, "length" specifies
the length of each element.
Example:
<?php
print_r(str_split("Halloween"));
?>
Result:
Array
(
[0] => H
[1] => a
[2] => l
[3] => l
[4] => o
[5] => w
[6] => e
[7] => e
[8] => n
)
In the above example "Halloween" is split into a array of individual string.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|