<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NewSourceMedia Blog &#187; phone number</title>
	<atom:link href="http://newsourcemedia.com/blog/tag/phone-number/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Wed, 11 Aug 2010 13:56:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Validation Numbers Only From</title>
		<link>http://newsourcemedia.com/blog/php-validation-numbers-only-from/</link>
		<comments>http://newsourcemedia.com/blog/php-validation-numbers-only-from/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 06:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Forms]]></category>
		<category><![CDATA[Math and Numbers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[credit card]]></category>
		<category><![CDATA[digit]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[phone number]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[validate]]></category>
		<category><![CDATA[zip code]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-validation-numbers-only-from/</guid>
		<description><![CDATA[How to check for number values only and block or convert letter strings to integers.

Question: How to validate number values to and block all letters and symbol in a form.
Answer: You can check the value or convert the value to an integer (number).
1) Check a value using is_int() to finds whether the given variable is [...]]]></description>
			<content:encoded><![CDATA[<p>How to check for number values only and block or convert letter strings to integers.<br />
<span id="more-170"></span></p>
<p><strong>Question:</strong> How to validate number values to and block all letters and symbol in a form.</p>
<p><strong>Answer:</strong> You can check the value or convert the value to an integer (number).</p>
<p>1) Check a value using is_int() to finds whether the given variable is an integer</p>
<p><code>&lt;?<br />
if(is_int($variable))<br />
echo "Pass test";<br />
else<br />
echo "Please use only numbers";<br />
?&gt; </code></p>
<p>2) Note: To test if a variable is a number or a numeric string (such as form input, which is always a string), you must use is_numeric().</p>
<p><code>&lt;?<br />
if(is_numeric($variable))<br />
echo "Pass test";<br />
else<br />
echo "Please use only numbers";<br />
?&gt; </code></p>
<p>3) Convert the value to an integer (number) using settype.</p>
<p><code>&lt;?php<br />
$foo = "5bar"; // string<br />
$bar = true; // boolean</code></p>
<p>settype($foo, &#8220;integer&#8221;); // $foo is now 5 (integer)<br />
settype($bar, &#8220;string&#8221;); // $bar is now &#8220;1&#8243; (string)<br />
?&gt;</p>
<p>or you can use int to do the trick.</p>
<p><code><br />
&lt;?<br />
$int=593; // $int is a integer<br />
$int.=""; // $int is now a string<br />
?&gt;<br />
</code></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://newsourcemedia.com/blog/php-leading-zero-for-double-digit-numbers/" rel="bookmark">PHP Leading Zero for Double Digit Numbers</a></li><li><a href="http://newsourcemedia.com/blog/mysql-table-fields-data-types/" rel="bookmark">MySQL Table Fields Data Types</a></li><li><a href="http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/" rel="bookmark">PHP strip remove white space from end of string</a></li><li><a href="http://newsourcemedia.com/blog/php-round-off-decimal-or-convert-to-decimal-point/" rel="bookmark">PHP Round Off Decimal or Convert to Decimal Point</a></li><li><a href="http://newsourcemedia.com/blog/php-how-to-find-odd-and-even-numbers/" rel="bookmark">PHP how to find Odd and Even numbers</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-validation-numbers-only-from/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->