Hello all,
I need your help in this recursion problem.
I would like to show a random number on a page, as long as it is viewed.
Value '1000' passed to the function is an arbitary value, there is nothing special in other value.
<table>
<tr>
<?php
$number_code=doSomething(1000) ;
?>
<font color="#<?php echo $number_code ; ?>" >
</tr>
</table>
<?PHP
function doSomething($curr_val)
{
if ($curr_val > 0)
{
$var_1 = array(1,2,3,4) ;
$var_2 = array(1,2,3,4) ;
$var_3 = array(1,2,3,4) ;
$var_4 = array(1,2,3,4) ;
$temp_1 = rand(1,count($var_1)) ;
$temp_2 = rand(1,count($var_2)) ;
$temp_3 = rand(1,count($var_3)) ;
$temp_4 = rand(1,count($var_4)) ;
$number_formed = $var_1[$temp_1]." ".$var_2[$temp_2]." ".$var_3[$temp_3]." ".$var_4[$temp_4] ;
// $curr_val-- ;
$number_formed = doSomething($curr_val);
}
return $number_formed;
}
$color_code = doSomething(1000);
?>
When I execute this code, the error message shown is "The document contains no data".
Can anybody help me out in this?
Thanks in advance.