Like stated already don’t know what you are trying to do, but I would do something like this to learn functions, loops and random numbers.
[php]<?php
$dice = [];
function dice($min, $max) {
$roll = rand($min, $max);
return $roll;
}
$min = 1;
$max = 6;
for ( $i=0; $i<2; $i++) {
$dice[$i] = dice($min, $max);
}
//echo “
” . print_r($dice, 1) . “
\n”;
$total = $dice[0] + $dice[1];
echo "Dice Number One = " . $dice[0] . " and Dice Number Two = " . $dice[1] . " for a Total of " . $total . “
\n”; [/php]
Just playing around with this script or creating your own randomize script with a little logic behind it can be fun and learning at the same time. One thing that I do is try to name my variables/functions/classes that are meaningful in a script, sometimes it can be a little tricky coming up with an appropriate name(s). However that is where find and replace comes in handy in most IDE when the appropriate name comes into your head. 