i want to modify a script a little rite now its generating random entries Using this code gencode(rand(3,10)) Code (markup): I Want it give values numerical wise (eg 1-2-3-4-5 and so on) what should i doo Thanks
Something similar to this? <?php $valid = false; while( !$valid ) { $num1 = rand(1,9); $num2 = rand(1,9); $num3 = rand(1,9); $num4 = rand(1,9); $num5 = rand(1,9); $num6 = rand(1,9); $num7 = rand(1,9); $num8 = rand(1,9); $num9 = rand(1,9); $calc = ( $num1 * 1 ) + ( $num2 * 2) + ( $num3 * 3) + ( $num4 * 4) + ( $num5 * 5) + ( $num6 * 6) + ( $num7 * 7) + ( $num8 * 8) + ( $num9 * 9); $numb = $calc / 11; if( is_int( $numb ) ) { echo $num9 . $num8 . $num7 . $num6 . $num5 . $num4 . $num3 . $num2 . $num1; $valid = true; } } ?> Code (markup):
powerextreme lawrenz already answered that questionand so did lephron if you jsut want it to echo the number in sequence [and not go into the function gencode] then look at lawrenz post..if you want it in sequence but then that number goes in the function gencode then read lephron's reply all you need to do is run a forloop like the above 2 users showed