Cannot get strlen to work correctly

I am trying to count the number of characters in an array that originates as a text file.

I read the array to get its contents and assign a variable to it:
[php]
$txt_file = file_get_contents($fileloc);
$rows = explode("", $txt_file);
array_shift($rows);

foreach($rows as $row => $data)
{
//get row data
$row_data = explode(’/’, $data);

$info[$row]['id'] = $row_data[0];

	$text = $row_data[0];

}

[/php]I do some other operations with the $text, without changing anything about it, and then use this call:

echo strlen($text);

The value returned is 84 but I know for a fact the correct number is 67. Any ideas? This is the contents of the text file:

3/4 B-1 PS PLK ALDER 7MDFSMROZ 48.5X96.5 47195 LMC P2EXEMPT-HP1-09

Are you positive there is nothing else there?

Try going this route to verify what you thing:
[php]echo “

”;
echo strlen($text);
echo $text;
echo “
”;[/php]

If you just add the “/” and “” your string has 80 characters.

Also, are you using the trim() function in the extra code? Perhaps there are spaces you are not counting?

Sponsor our Newsletter | Privacy Policy | Terms of Service