<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[PHP Forums - [Tutorial] How to generate a random number in PHP]]></title>
	<link rel="self" href="http://www.phpforums.org/feed-atom-topic12.xml"/>
	<updated>2009-10-08T21:29:49Z</updated>
	<generator>PunBB</generator>
	<id>http://phpforums.org/topic12-tutorial-how-to-generate-a-random-number-in-php.html</id>
		<entry>
			<title type="html"><![CDATA[[Tutorial] How to generate a random number in PHP]]></title>
			<link rel="alternate" href="http://phpforums.org/post23.html#p23"/>
			<content type="html"><![CDATA[<p>Hello!</p><p>Here is some basic tutorial on how to generate a random number in PHP.</p><p>Random numbers in PHP are generated using the rand() function. Let&#039;s write some code that will generate a random number between 1 and 10.</p><div class="codebox"><pre><code>&lt;?php
echo rand(1, 10);
?&gt;</code></pre></div><p>If you need more than one random number generated, use rand() function in a loop. Here is a code for generating three random numbers between 10 and 20.</p><div class="codebox"><pre><code>&lt;?php
for ($i = 0; $i &lt; 3; $i++)
{
    echo rand(10, 20) . &quot; &quot;;
}
?&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Einherjar]]></name>
				<uri>http://phpforums.org/user2.html</uri>
			</author>
			<updated>2009-10-08T21:29:49Z</updated>
			<id>http://phpforums.org/post23.html#p23</id>
		</entry>
</feed>

