Example 1 — Split into Characters
With no length, each character becomes an array item.
<?php
$chars = str_split("PHP");
print_r($chars); How It Works
- Pass a short string to str_split.
- The default length is 1.
- Each character becomes one array element.
- print_r shows the array with its indexes.

