Php Programming Code Examples
Php > Arrays Code Examples
How to Get a character array from a string
How to Get a character array from a string
The reason I did this was to put a string into pictures, (I had pictures of each
letter from a keyboard, and wanted to make words) but obviously you can use it for
anything.
<?php
// Your string (Maybe retried from a random generator)
$string = "String";
$chars = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
foreach($chars as $image){
$dan .= "<img src=\"./$image.jpg\">";
}
echo $dan;
?>