Difference between revisions of "PHPEX02"

From mi-linux
Jump to navigationJump to search
Line 5: Line 5:
 
Define a constant 'my_year' to the year of your birth.  A loop should randomly generate numbers in the range 1900 to 1999, each number should be displayed on screen.  This should continue until the number which has been randomly generated matches the year of your birth.  The code to generate a random number in this range is given below:
 
Define a constant 'my_year' to the year of your birth.  A loop should randomly generate numbers in the range 1900 to 1999, each number should be displayed on screen.  This should continue until the number which has been randomly generated matches the year of your birth.  The code to generate a random number in this range is given below:
  
<nowiki><?
+
<pre>
 +
<?
 
     $any_year = rand(1900, 1999);
 
     $any_year = rand(1900, 1999);
 
     print $any_year;
 
     print $any_year;
?></nowiki>
+
?>
 +
</pre>

Revision as of 09:21, 18 July 2011

Main Page >> Web Application Development >> Workbook >> Mini-task 02

Mini-task 02

Define a constant 'my_year' to the year of your birth. A loop should randomly generate numbers in the range 1900 to 1999, each number should be displayed on screen. This should continue until the number which has been randomly generated matches the year of your birth. The code to generate a random number in this range is given below:

<?
    $any_year = rand(1900, 1999);
    print $any_year;
?>