Using str_split on a UTF-8 encoded string

Mind that the utf8 declaration used in your connect-string is reported to be not working.
In the comments on php.net I frequently see this alternative:

$dbHandle = new PDO("mysql:host=$dbHost;dbname=$dbName;charset=utf8", $dbUser, $dbPass,
                    array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));

Leave a Comment