Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/02/2012, 02:39
Avatar de repara2
repara2
 
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 14 años, 4 meses
Puntos: 331
Respuesta: Busquedas en tabla con While

Un ejemplo:

Código PHP:
Ver original
  1. <?php
  2. $coche = array ("Clio", "Megane", "Corsa", "Astra");
  3. $buscado = "Corsa";
  4. for ($i=0; $i < count($coche); $i++)
  5. {
  6.     if($buscado == $coche[$i]) echo "Encontrado '$buscado' en ".($i+1)." iteraciones....<br>";
  7. }
  8. ?>
__________________
Fere libenter homines, id quod volunt, credunt.