You are here: from string to integer/double problem « All PHP « IT news, forums, messages
from string to integer/double problem

Posted by nescio on 11/15/05 21:22

hello,

i have got a variable with the value '$rij[2] = "16.60" (it is the price of
something);
but i want this value to be a integer or a double, because i need to know
how many cents the amount is.

i have tried 'settype($variable, "double"); but it is not working;

---------------source code ---------------------------
function bedragInCenten($bedrag){
$nieuw = settype($bedrag, "double");
$nieuw = $nieuw * 100;
return $nieuw;
}

$demo = "16.60";

bedragInCenten($demo);

--------------------------------------------------------

i always get '100' as an outcome.
can someone explain this to me, and show me how to do it wright?

thanks

 

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

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