Tuesday, 20 April 2021

PHP RANDOM ARRAY EXTERNAL FILE. MT_RAND()

 <?php

// You can do this, programmatically, using the following code ... Test It Yourself (TIY)

$colors=(file("random.txt"));//colors array


$c1=sizeof($colors)-1;//get position of the last element within the colors array


//    -- OR, if you prefer --

//$c1=count($colors)-1;//get position of the last element within the colors array


//pick a color at random from the colors array - 'Mersenne Twister based'

$color=$colors[mt_rand(0,$c1)];


echo<<<HERE

<!DOCTYPE html>

<html>

<head>

   <meta http-equiv="refresh" content="2">

</head>

<body>

   <div style="width:400px; background-color:$color; border:1px; text-align:center;" >

     $color

   </div>

</body>

</html>

HERE;

?>

email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...