<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[PHP Forums - [Tutorial] How to find if a number is odd or even]]></title>
	<link rel="self" href="http://www.phpforums.org/feed-atom-topic13.xml"/>
	<updated>2009-10-08T23:27:10Z</updated>
	<generator>PunBB</generator>
	<id>http://phpforums.org/topic13-tutorial-how-to-find-if-a-number-is-odd-or-even.html</id>
		<entry>
			<title type="html"><![CDATA[[Tutorial] How to find if a number is odd or even]]></title>
			<link rel="alternate" href="http://phpforums.org/post24.html#p24"/>
			<content type="html"><![CDATA[<p>Hi there!</p><p>In this tutorial I&#039;ll write some basic PHP code on how to find if a number is odd or even.</p><p>The idea behind the code is that even numbers have zero reminder when divided by 2, while odd numbers have 1 as a reminder after division by 2. For this I&#039;ll use PHP modulus operator (%).</p><div class="codebox"><pre><code>&lt;?php
if ($number % 2 == 0)
{
    echo &quot;even&quot;;
}
else
{
    echo &quot;odd&quot;;
}
?&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Einherjar]]></name>
				<uri>http://phpforums.org/user2.html</uri>
			</author>
			<updated>2009-10-08T23:27:10Z</updated>
			<id>http://phpforums.org/post24.html#p24</id>
		</entry>
</feed>

