You are here: Re: $string filter for currency 0.00... help « All PHP « IT news, forums, messages
Re: $string filter for currency 0.00... help

Posted by Janwillem Borleffs on 05/05/06 12:40

jenngra@gmail.com wrote:
> Hello! Can someone pls help me create a string filter, which will only
> pass currency amounts
>
> "0.00" to "999999.99" and nothing else. So, I need a decimal in there
> and don't understand the filter process, so if you could briefly
> explain how it works that would be so great :) TAM! -Jennifer
>

One way would be to apply casting:

$num = "0.005";
$num2 = "a0.005";

print (float) $num ? 1 : 0; // prints 1
print (float) $num2 ? 1 : 0; // prints 0


JW

 

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

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