Difference between revisions of "PHPEX02"

From mi-linux
Jump to navigationJump to search
Line 19: Line 19:
  
 
<pre>
 
<pre>
<?
+
<?php
 
     $any_year = rand(1900, 1999);
 
     $any_year = rand(1900, 1999);
 
     print $any_year;
 
     print $any_year;

Revision as of 13:25, 29 June 2016

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

Mini-task - week 02

Define a constant 'my_year' equal 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, for example:

1914
1967
1987
1955
1901
1976 => This is when Alix was born!

Note: The code to generate a random number in this range is given below:

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

Important: you should commit your code to your GitLab project.

Important: Make sure that your page's HTML is valid!