Is there a nice way to iterate on the characters of a string? I\'d like to be able to do foreach, array_map, array_walk, array_
foreach
array_map
array_walk
array_
Step 1: convert the string to an array using the str_split function
str_split
$array = str_split($your_string);
Step 2: loop through the newly created array
foreach ($array as $char) { echo $char; }
You can check the PHP docs for more information: str_split