<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Php function to validate two decimal places of a number</title>
	<atom:link href="http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/feed" rel="self" type="application/rss+xml" />
	<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html</link>
	<description>Useful Tutorials, Scripts , Tips, and Resources for all PHP and Ajax beginners and experts .</description>
	<lastBuildDate>Wed, 10 Mar 2010 10:59:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: sheathe</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-4741</link>
		<dc:creator>sheathe</dc:creator>
		<pubDate>Tue, 27 Oct 2009 08:27:16 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-4741</guid>
		<description>Thanks for your article. How would I check for a dollar amount that may or may not have a decimal and may or may not have two decimal places. For example, all of the following are acceptable:

100
100.5
100.50
100.55
1000

No characters besides the decimal and numbers are allowed (no boolean either).
It can also not have more than 2 decimals. 

e.g. 100.555 is not acceptable (if this is difficult, it could be trimmed)
Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Thanks for your article. How would I check for a dollar amount that may or may not have a decimal and may or may not have two decimal places. For example, all of the following are acceptable:</p>
<p>100<br />
100.5<br />
100.50<br />
100.55<br />
1000</p>
<p>No characters besides the decimal and numbers are allowed (no boolean either).<br />
It can also not have more than 2 decimals. </p>
<p>e.g. 100.555 is not acceptable (if this is difficult, it could be trimmed)<br />
Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ujjwal B Soni</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-3423</link>
		<dc:creator>Ujjwal B Soni</dc:creator>
		<pubDate>Tue, 30 Dec 2008 11:55:53 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-3423</guid>
		<description>Hi,

Nice Article!!!

Cheers!!!

Ujjwal B Soni</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Nice Article!!!</p>
<p>Cheers!!!</p>
<p>Ujjwal B Soni</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gowtham</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-2297</link>
		<dc:creator>gowtham</dc:creator>
		<pubDate>Wed, 10 Sep 2008 13:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-2297</guid>
		<description>Mr.Roshan thanks very much, very simple but powerfull once again thanks....</description>
		<content:encoded><![CDATA[<p>Mr.Roshan thanks very much, very simple but powerfull once again thanks&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-825</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Sun, 11 May 2008 08:41:26 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-825</guid>
		<description>if something related to my blog post then no problem at all..</description>
		<content:encoded><![CDATA[<p>if something related to my blog post then no problem at all..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sunil</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-824</link>
		<dc:creator>Sunil</dc:creator>
		<pubDate>Sun, 11 May 2008 08:14:30 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-824</guid>
		<description>Thanxs very much Roshan.

I wld like to ask u, can I ans you other questions related to PHP. I mean not related to this numeric ones. I wld be thankful if u can help me.

Byee and have a nice day.</description>
		<content:encoded><![CDATA[<p>Thanxs very much Roshan.</p>
<p>I wld like to ask u, can I ans you other questions related to PHP. I mean not related to this numeric ones. I wld be thankful if u can help me.</p>
<p>Byee and have a nice day.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-820</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Sat, 10 May 2008 14:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-820</guid>
		<description>hey sunil for that you can use ctype_digit() function available in php</description>
		<content:encoded><![CDATA[<p>hey sunil for that you can use ctype_digit() function available in php</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sunil</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-819</link>
		<dc:creator>Sunil</dc:creator>
		<pubDate>Sat, 10 May 2008 14:30:10 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-819</guid>
		<description>Hello everyone.

I used the above mentioned script and it worked. But I have some difficulties. I want the script such that if suppose i input value as &quot;sdga&quot; then it should give error. And if i insert something like 562 it should not give error.</description>
		<content:encoded><![CDATA[<p>Hello everyone.</p>
<p>I used the above mentioned script and it worked. But I have some difficulties. I want the script such that if suppose i input value as &#8220;sdga&#8221; then it should give error. And if i insert something like 562 it should not give error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-688</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Thu, 24 Apr 2008 05:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-688</guid>
		<description>Well for this kind of search....google&#039;s custom search or google&#039;s site search is better you...</description>
		<content:encoded><![CDATA[<p>Well for this kind of search&#8230;.google&#8217;s custom search or google&#8217;s site search is better you&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmad Ginani</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-684</link>
		<dc:creator>Ahmad Ginani</dc:creator>
		<pubDate>Thu, 24 Apr 2008 04:36:57 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-684</guid>
		<description>Would you please help me for following problem ?

I want to prepare a php script by means of which user can search the string through out the current web site, but the site content is static, do not depend upon database........

Could you please tell me how I start ?</description>
		<content:encoded><![CDATA[<p>Would you please help me for following problem ?</p>
<p>I want to prepare a php script by means of which user can search the string through out the current web site, but the site content is static, do not depend upon database&#8230;&#8230;..</p>
<p>Could you please tell me how I start ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmad Ginani</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-683</link>
		<dc:creator>Ahmad Ginani</dc:creator>
		<pubDate>Thu, 24 Apr 2008 04:10:45 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-683</guid>
		<description>Yeah...., you are right, Thank you again Roshan..</description>
		<content:encoded><![CDATA[<p>Yeah&#8230;., you are right, Thank you again Roshan..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-650</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Sat, 19 Apr 2008 12:23:54 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-650</guid>
		<description>Nice to hear that Giani...but you choose the very long way to do so...I think 

echo number_format($number,2);

could have easily solved your problem rather than that long function...

Am I right ?</description>
		<content:encoded><![CDATA[<p>Nice to hear that Giani&#8230;but you choose the very long way to do so&#8230;I think </p>
<p>echo number_format($number,2);</p>
<p>could have easily solved your problem rather than that long function&#8230;</p>
<p>Am I right ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ginani Ahmad</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-647</link>
		<dc:creator>Ginani Ahmad</dc:creator>
		<pubDate>Sat, 19 Apr 2008 11:52:10 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-647</guid>
		<description>Thank you very much,  you have saved lots of my time, I was needing the value which should have 2 decimal point, if I get value 10 then it must be converted to 10.00.....thank you very much, finally I got the solution by following function : 

function getFloat($number)
{
  if(is_float($number))
  {
    if(ereg(&quot;^[0-9]+\.[0-9]{1}$&quot;, $number))
       $number = $number.&quot;0&quot;;
    else
	$number = round($number, 2);
  }
  else
    $number = $number.&quot;.00&quot;;
  return $number; 	
}</description>
		<content:encoded><![CDATA[<p>Thank you very much,  you have saved lots of my time, I was needing the value which should have 2 decimal point, if I get value 10 then it must be converted to 10.00&#8230;..thank you very much, finally I got the solution by following function : </p>
<p>function getFloat($number)<br />
{<br />
  if(is_float($number))<br />
  {<br />
    if(ereg(&#8220;^[0-9]+\.[0-9]{1}$&#8221;, $number))<br />
       $number = $number.&#8221;0&#8243;;<br />
    else<br />
	$number = round($number, 2);<br />
  }<br />
  else<br />
    $number = $number.&#8221;.00&#8243;;<br />
  return $number;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP Coding School &#187; Blog Archive &#187; php tips [2008-02-10 10:55:27]</title>
		<link>http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html/comment-page-1#comment-332</link>
		<dc:creator>PHP Coding School &#187; Blog Archive &#187; php tips [2008-02-10 10:55:27]</dc:creator>
		<pubDate>Sun, 10 Feb 2008 11:09:33 +0000</pubDate>
		<guid isPermaLink="false">http://roshanbh.com.np/2008/02/validation-two-decimal-places-php.html#comment-332</guid>
		<description>[...]  Php function to validate two decimal places of a number  By Roshan  If you are looking for the validation of a number which contains only two decimal places. Means you want to accept the values like 0.21 or 1.34 or 12.55 or 445.66 as a input and throw an error when somebody enters the number like 0.2 or &#8230;   Roshan Bhattarai&#8217;s Blog - PHP&#8230; - http://roshanbh.com.np [...]</description>
		<content:encoded><![CDATA[<p>[...]  Php function to validate two decimal places of a number  By Roshan  If you are looking for the validation of a number which contains only two decimal places. Means you want to accept the values like 0.21 or 1.34 or 12.55 or 445.66 as a input and throw an error when somebody enters the number like 0.2 or &#8230;   Roshan Bhattarai&#8217;s Blog &#8211; PHP&#8230; &#8211; <a href="http://roshanbh.com.np" rel="nofollow">http://roshanbh.com.np</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
