Ver Mensaje Individual
  #12 (permalink)  
Antiguo 26/02/2013, 09:34
Avatar de JeMaGa
JeMaGa
 
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: tomar el mayor valor de un arreglo

Hola oye una pregunta, estoy mostrando el numero mayor asi

Código PHP:
Ver original
  1. $valores = $_POST["valores"];
  2.  
  3.    
  4. foreach($separador = explode(",",$valores[0]) as $d)
  5. {
  6.     if(empty($nro))
  7.     {
  8.         $nro = $d;
  9.         $mayor = $nro;
  10.     }
  11.     else
  12.     {
  13.         if($d > $mayor)
  14.         {
  15.             $mayor = $d;
  16.            
  17.         }
  18.     }
  19. }
  20.  
  21. echo $mayor."</br>";

como puedo mostrar el menor