Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/05/2012, 10:57
Avatar de jotaincubus
jotaincubus
 
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 19 años
Puntos: 394
Respuesta: buscar palabra

Código PHP:
Ver original
  1. $cajaTexto = "N1-NARANJAS";
  2. $array=array("NA"=>"NARANJAS", "PE" => "PERAS", "TM" => "TOMATES");
  3.  
  4. $separarCajaTexto = explode("-", $cajaTexto);
  5.  
  6. if($resultado = array_search($separarCajaTexto[1], $array)){
  7. echo $resultado;
  8. }else{
  9. echo 'No se encontraron coincidencias';
  10. }

NOTA: FIJATE EL CAMBIO QUE LE HICE AL ARRAY

No tuve la oportunidad de comprobarlo... espero te sirva.
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???