Send to a Friend

klaas4's avatar

Cut a string into pieces (PHP! ;-) )

Asked by klaas4 (2189points) May 1st, 2008

I have a random string of 8 characters, always, and I want to split it in 8 arrays with one character each. So for example the string is = “YMy32fJu”, so I want this:

$string_array[0] = “Y”;
$string_array[1] = “M”;
$string_array[2] = “y”;
$string_array[3] = “3”;
$string_array[4] = “2”;
$string_array[5] = “f”;
$string_array[6] = “J”;
$string_array[7] = “u”;

How do you do this? It’s probably very simple, but I don’t have so much knowledge about arrays.

Davey

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.