"Empty delimiter" Warning when using PHP explode() function
I think str_split is what you are after
str_split — Convert a string to an array
<?php
$arr = str_split("Hello");
?>
will produce
Array
(
[0] => H
[1] => e
[2] => l
[3] => l
[4] => o
}
If dealing with multi-byte UTF-8 strings you should use:
$array = preg_split('//u', $My_String,-1, PREG_SPLIT_NO_EMPTY);
Otherwise you can just use:
$array = str_split($My_String);
The reason is noted in the manual:
str_split() will split into bytes, rather than characters when dealing with a multi-byte encoded string.
Starting from PHP version 7.4 the mbstring equivalent of str_split was added so you can now use:
$array = mb_str_split($my_string);
mb_str_split
manual page