<p>Say I have a string of 16 numeric characters (i.e. 0123456789012345) what is the most efficient way to delimit it into sets like : 0123-4567-8901-2345, in PHP?</p>

<p>Note: I am rewriting an existing system that is painfully slow.</p>

Use
str_split()
:
```
```
$string = '0123456789012345';
$sets = str_split($string, 4);
print_r($sets);
```
```
The output:
```
```
Array
(
    [0] => 0123
    [1] => 4567
    [2] => 8901
    [3] => 2345
)
```
```
Then of course to insert hyphens between the sets you just
implode()
them together:
```
```
echo implode('-', $sets); // echoes '0123-4567-8901-2345'
```
```