<?php
/*
 * 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).')/Us'$string$matches);
    return 
$matches[1];
  }
}

$foo "0123456789abcdefg";
$chars str_split($foo1);
print 
'<pre>'var_dump($chars);
$chars str_split($foo2);
print 
'<pre>'var_dump($chars);

?>