NOKIA

pages of blog

Wednesday 9 July 2014

function random in PHP


hello

how are you

i hope that you are fine !!

our cour is to use the RANDOM  : it is a function

in php is called rand , the parametre is 2 integers

from , and to

exemple : rand(1,10) may be = 1 or 2 r... to 10

ok ... we try to write a script PHP using this function

<?php

$rnd=rand(1,10);

echo $rnd;

if ($rnd<5) echo "lose";

else echo "wine";

?>

ok ... save this file in c:\appserv\www\

set the name of file rnd.php

try it .....

its simple and very easy

thank you , we hope to see you in next cour


No comments:

Post a Comment