Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/02/2014, 22:10
manuel__7
 
Fecha de Ingreso: abril-2012
Mensajes: 88
Antigüedad: 12 años
Puntos: 1
Respuesta: Contar cantidad de valores existentes en un rango dentro de un array

Código PHP:
<?

function distancia_meses($mes1,$mes2$meses) {
    
    
$posicion_mes1=array_search($mes1$meses)+1;
    
$posicion_mes2=array_search($mes2$meses)+1;
    
$suma_meses $posicion_mes2 $posicion_mes1 1;
    return 
$suma_meses;
}


$meses = array("ENERO""FEBRERO""MARZO""ABRIL""MAYO""JUNIO""JULIO""AGOSTO""SEPTIEMBRE""OCTUBRE""NOVIEMBRE""DICIEMBRE");

echo 
'Meses: '.distancia_meses("ABRIL","JUNIO"$meses);

?>