I;m trying to get the length of a string and then convert it into an array of characters. I need to know the length of the string that can be different lengths but when I use strlen it comes up with 57 when the string is 55 characters.
I did a var_dump and was told the array had 55 elements in it, where as strlen told me it was 57 characters long.
Am I doing wrong here?
Code:
//This fuction is almost the same as the fuction str_split included in php5.
function strsplt($thetext,$num)
{
if (!$num)
{
$num=1;
}
$arr=array();
$xfive=floor(strlen($thetext)/$num);
while ($ifive<=$xfive)
{
$yfive=substr($thetext,$jfive,$num);
if ($yfive)
{
array_push($arr,$yfive);
}
$ifive++;
$jfive=$jfive+$num;
}
return $arr;
}
$code=$_GET['code'];
if ($code)
{
$size=strlen($code);
$decode=strsplt($code, 1);
Am I doing wrong here?
Comment