note 112624 added to function.str-split
| From: | jakub dot lopuszanski at nasza-klasa dot pl | Date: | Fri, 05 Jul 2013 13:38:58 +0000 |
| Subject: | note 112624 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195469@lists.php.net to get a copy of this message | ||
To split UTF-8 into 16-charcater slices you can use:
<?php
preg_split('/(?=(.{16})*$)/u', $text);
?>
You can also use look-behind instead of look-ahead if you want the first (not the last) chunk to be
the shortest.
----
Server IP: 69.147.83.199
Probable Submitter: 195.88.186.2
----
Manual Page -- http://php.net/manual/en/function.str-split.php
Edit -- https://master.php.net/note/edit/112624
Del: integrated -- https://master.php.net/note/delete/112624/integrated
Del: useless -- https://master.php.net/note/delete/112624/useless
Del: bad code -- https://master.php.net/note/delete/112624/bad+code
Del: spam -- https://master.php.net/note/delete/112624/spam
Del: non-english -- https://master.php.net/note/delete/112624/non-english
Del: in docs -- https://master.php.net/note/delete/112624/in+docs
Del: other reasons-- https://master.php.net/note/delete/112624
Reject -- https://master.php.net/note/reject/112624
Search -- https://master.php.net/manage/user-notes.php