I’m trying to separate characters in an array into another array with only 1 character in each.
Here is the array: $char[0] = “Rr”; $char[1] = “Ss”; $char[3] = “TT”; Etc...
And what I want to get out of that is this array: $char[0][1] = “R”; $char[0][2] = “r”; $char[1][1] = “S”; $char[1][2] = “s”; Etc...
Please help me to solve the problem.
If I understand what you are trying to accomplish correctly:
$char[0][1] = substr($char[0],0,1); $char[0][2] = substr($char[0],1,1); $char[1][1] = substr($char[1],0,1); $char[1][2] = substr($char[1],1,1); Etc..
What is it that you are trying to do that is not covered by the following (from the manual)?
"Characters within strings may be accessed by specifying the zero-based offset of the desired character after the string in curly braces. Note: For backwards compatibility, you can still use the array-braces. However, this syntax is deprecated as of PHP 4."
But what should I do if I dont know how many of those $char arrays I have. The script should do all the work...