Reputation: 255
Ok I know this is simple, in fact damn simple, I did this in the last project about a week ago, but I don't know why it has skipped off my head.
Input:
$word = "stack";
What I want to do is:
$array = array("s", "t", "a", "c", "k");
Any help will be appreciated!
Upvotes: 1
Views: 118
Reputation: 4551
Your question isn't too clear, but I suspect you want to turn your string into an array. You don't have to, actually. You can just access $word as if it were an array:
$word = 'stack';
for ($i=0, $m = strlen($word); $i < $m; $i++)
echo $word[$i], "\n";
Upvotes: 3