note 37501 added to function.str-split

From: Date: Tue, 18 Nov 2003 00:07:07 +0000
Subject: note 37501 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-60546@lists.php.net to get a copy of this message
A neat solution for older versions of PHP is: http://www.pgregg.com/projects/php/code/str_split.phps (I had wrote this as strsplit() before I found out str_split() existed, so I renamed mine): /* * split a string up into equal sized chunks * * Paul Gregg <pgregg@pgregg.com> * 23 September 2003 * * Open Source Code: If you use this code on your site for public * access (i.e. on the Internet) then you must attribute the author and * source web site: http://www.pgregg.com/projects/php/code/str_split.phps * str_split is available from PHP version 5 by default * */ if (!function_exists('str_split')) { Function str_split($string, $chunksize=1) { preg_match_all('/('.str_repeat('.', $chunksize).')/Uims', $string, $matches) ; return $matches[1]; } } ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37501 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37501&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37501&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60546) next »