note 106827 deleted from function.str-split by danbrown

From: Date: Sun, 11 Dec 2011 19:11:24 +0000
Subject: note 106827 deleted from function.str-split by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185030@lists.php.net to get a copy of this message
Note Submitter: Paul ---- In addition to ference at super_delete_brose dot co dot uk (http://php.net/manual/en/function.str-split.php#69331) it would be good to include encoding detection for the multi-byte split function because the multi-byte functions default to the internal encoding value. The multi-byte split function would look something like this: <?php function mb_str_split($str, $length = 1) { if ($length < 1) return false; if (!($encoding = mb_detect_encoding($str))) $encoding = mb_internal_encoding(); for ($result = array(), $i = 0; $i < mb_strlen($str, $encoding); $i += $length) $result[] = mb_substr($str, $i, $length, $encoding); return $result; } ?>

« previous php.notes (#185030) next »