Definition
The str_split() function splits a string into an array.
Syntax
str_split(string, length)
Parameters
Parameter | Description |
---|---|
string |
Required. Specifies the string to split. |
length |
Optional. Specifies the length of each array element. Default is 1. |
Example
<?php
print_r(str_split("Welcome to PHP"));
echo "<br>";
print_r(str_split("Welcome to PHP", 7));