I need this function to be recursive, I'm a beginner in php and I'm not really understanding how I can do this. :
<?php
function mostraArray() {
$cena=array($_REQUEST["numeroa"], $_REQUEST["numerob"], $_REQUEST["numeroc"], $_REQUEST["numerod"], $_REQUEST["numeroe"]);
for ($i=0; $i<=count($cena)-1; $i++) {
return $cena[$i];
if ($i<4){
return ", ";
}
}
}
function ordenaArray() {
$cena=array($_REQUEST["numeroa"], $_REQUEST["numerob"], $_REQUEST["numeroc"], $_REQUEST["numerod"], $_REQUEST["numeroe"]);
rsort($cena);
for ($i=0; $i<=count($cena)-1; $i++) {
return $cena[$i];
if ($i<4){
return ", ";
}
}
}
echo "<p align=\"center\">Números pela <u>ordem de saída</u>: ".mostraArray()."</p>";
echo "<p align=\"center\">Números pela <u>ordem decrescente</u>: ".ordenaArray()."</p>"
?>
obs: It's for php class, this is the exercise