``` --- ## Definition and Usage "> ``` --- ## Definition and Usage " />
Easy Tutorial
❮ Func Array Diff Func Array Current ❯

PHP str_split() Function

PHP String Reference Manual

Example

Split the string "Hello" into an array:

<?php
print_r(str_split("Hello"));
?>

Definition and Usage

The str_split() function splits a string into an array.


Syntax

Parameter Description
string Required. The string to be split.
length Optional. The length of each array element. Default is 1.

Technical Details

Return Value: If length is less than 1, str_split() function will return FALSE. If length is greater than the length of the string, the entire string will be returned as the only element of the array.
PHP Version: 5+
--- ---

More Examples

Example 1

Using the length parameter:

❮ Func Array Diff Func Array Current ❯