Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/11/2012, 22:28
Avatar de truman_truman
truman_truman
 
Fecha de Ingreso: febrero-2010
Ubicación: /home/user
Mensajes: 1.341
Antigüedad: 14 años, 2 meses
Puntos: 177
Respuesta: funcion recursiva retornando array

en el caso de que entre aca:
if($hay < 16){

}
no hay ningún return, creo que por eso no hay resultados.


Aunque por otro lado yo veo resultados, fijate

Código PHP:
<?php 
$listCustom 
= array();
$equitativoZone[]['zona'] = 1;
$equitativoZone[]['zona'] = 2;
$equitativoZone[]['zona'] = 3;
$equitativoZone[]['zona'] = 4;
$equitativoZone[]['zona'] = 5;
$equitativoZone[]['zona'] = 6;
$equitativoZone[]['zona'] = 7;
$equitativoZone[]['zona'] = 8;
$equitativoZone[]['zona'] = 9;
/*$equitativoZone[]['zona'] = 10;
$equitativoZone[]['zona'] = 11;
$equitativoZone[]['zona'] = 12;
$equitativoZone[]['zona'] = 13;
$equitativoZone[]['zona'] = 14;
$equitativoZone[]['zona'] = 15;
$equitativoZone[]['zona'] = 16;
$equitativoZone[]['zona'] = 17;
$equitativoZone[]['zona'] = 18;
*/
function recursivo($equitativoZone)                                                         
{
                            
    global 
$listCustom;
                                                                                    
    foreach (
$equitativoZone as $keyZ => $equitativoZoneAlias){
        
        echo 
'-'.$listCustom[] = $equitativoZone[$keyZ]['zona'];
        echo 
'<br>';
    }
                                    
    echo 
$hay count($listCustom);
    echo 
'<br>';
                                                                                        
    if(
$hay 16){    
                                                                                 
        
recursivo($equitativoZone);
    
    }else{
    
        
        return 
$listCustom;
    }
     
 
}
echo 
'<pre>';
print_r($equitativoZone);

?>
__________________
la la la