You are here: Re: converting string to float « PHP Programming Language « IT news, forums, messages
Re: converting string to float

Posted by Rik on 02/15/07 18:09

On Thu, 15 Feb 2007 18:32:15 +0100, <pipe.jack@gmail.com> wrote:

> I'm trying to convert string to float and my float after conversion is=

> 0 (zero). Here is my code:
>
> $c =3D $currencies->format($cart->show_total());
> echo gettype($c);
> echo (float)$c;
>
> $c =3D 39.59
> gettype($c) =3D string
> echo (float)$c; =3D 0
>
> any other string such as "2.34" converted into float exactly the same
> way works fine.

Are you looking at this in a HTML page? If so, what does the source say?=
=

Someone just recently had this problem because the value was =

'<b>12.34</b>' rather then '12.34'.... Try an echo htmlentities($c);
-- =

Rik Wasmus

 

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

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