You are here: Converting string to number problem « PHP Programming Language « IT news, forums, messages
Converting string to number problem

Posted by acsandras on 12/06/05 12:23

I am trying to extract data from an iso-8859-1 encoded XML document. I
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;
András

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация