Re: problem with string & floats in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pablo,

Tuesday, May 15, 2007, 7:44:52 PM, you wrote:

> Hello, Im designing a website in which I have to read some data (numbers)
> from a txt file and then send this data to a function which prints a graphic
> with them. When I read the data I save it in an array and the numbers are in
> this format: 5.812E-08. I have read the php documentation about it, and I
> have use the example given there to check which type is the data saved in
> the array. The response I got is
> $vectorIc[1]== 5.812E-08 type is string

> I dont understand why. In the documentation it is clear that this kind of
> data should be considerer float, or thats what I understood. I cant continue
> with my web designing if I dont get to turn the vector elements into float
> numbers, because the function that prints the graphic gives errors when
> recieving strings. I would be very thankful if you could help me trying to
> solve this. In using PHP 4.4.7 and Apache 2.0.59.

Data stored in text files are ALWAYS strings. If you are reading it in
with something like fgets() then it'll be a string by default, unless
you cast it otherwise.

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux