rendered paste body<?
// $Text .= "[".$Key."] = ".$Item."<br>";
function showarraycontent($Entry,$Name = "")
{
if (!is_array($Entry))
{
//\\ Special case //\\ when entry is no an array
return $Name.' = '.$Entry.'<br>';
}
else
{
//\\ default //\\ when entry is an array
$Text = "";
$Keys = array_keys($Entry);
foreach($Keys as $Key)
{
$Item = $Entry[$Key];
//\\ Loop
$Text .= showarraycontent($Item,$Name.'['.$Key.'] ');
}
return $Text;
}
}
$test['Maria'] = "a";
$test['Joao']['carteira'] = "b";
$test['Paulo']['idade'] = "c";
$test['Luciana']['telefone'][2] = "d";
$test['Carol']['nome'][3] = "e";
echo showarraycontent($test)."<BR>";
function fatorial($n)
{
if ($n == 0)
{
//\\ Special case
return 1;
}
else
{
//\\ Loop //\\
return $n*fatorial($n-1);
}
}
function fib($n)
{
if (($n==1)||($n==2))
{
//\\ special case
return 1;
}
else
{
//\\ Loop //\\
return fib($n-1)+fib($n-2);
}
}
for($cont=1;$cont<20;$cont++)
echo "fibonacci($cont) = ".fib($cont)."<br>";
?>