> >Is there an easy way to get an array of characters from a string? > $str = 'string'; > $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); > print_r($chars);
A string is already an array of chars : $toto="test"; echo $toto[0]; // prints t echo $toto[1]; // prints e echo $toto[2]; // prints s echo $toto[3]; // prints t -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php