As this function is only available in php5, I had problems with it's availability, so i had to write my own. Here's the code:
<?php
function stringsplit($the_string, $the_number)
{
$startoff_nr = 0;
$the_output_array = array();
for($z = 1; $z < ceil(strlen($the_string)/$the_number)+1 ; $z++)
{
$startoff_nr = ($the_number*$z)-$the_number;
$the_output_array[] = substr($the_string, $startoff_nr, $the_number);
}
return($the_output_array);
}
$string = "so long and thanks for all the fish!";
$foo = stringsplit($string, 6);
print($foo);
?>
and this will output:
Array
(
[0] => so lon
[1] => g and
[2] => thanks
[3] => for a
[4] => ll the
[5] => fish!
)
what is exactly the same as str_split() 's output. hope this solves someones problems.