Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Converting string to number problem
December 6, 2005, 10:23 am
rate this thread
open the file, and read each line after each other, and extract some
values. These values are behaving oddly, though.
I can display them as strings:
echo $value; // Returns 0.4
echo "'$value'"; // Returns '0.4'
But I can not convert them into float:
echo floatval($value); // Returns 0
I did some debugging, which shows that the string length is 18, and not
3 as I axpected.
echo strlen($value); // Returns 18
The encoding is ASCII:
echo mb_detect_encoding($value); // Returns ASCII
Does anybody have an idea what this could be? I am using PHP 4.3.4.
Thanks in advance, best regards;
Re: Converting string to number problem
When echoing the value and viewing the results in IE, IE parsed <value>
as an HTML tag, and only showed '0.4'. I changed headeren to return
text/plain document, and I realised the problem this way.