I do speak Spanish, but for the sake of everyone who doesn't, let's keep the English :-)

1) Drop the comparison using "==", since you are comparing strings
2) Use STRCMP instead
3) Since this function is "case sensitive", maybe it's best to convert the string to upper case, and compare it after


My suggestion is (not tested) :

$leer = strtoupper($leer);

Also remove trailing and leading spaces

$leer = trim($leer);

Now check...

$result = strcmp($leer,"ACTIVADO")
if ($result == 0)
{
   // Activado
}
else
{
   // No activado
}


FROM THE DOCS

trcmp -- Binary safe string comparison


Description

int *strcmp* ( string str1, string str2)

Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.


Luis




Gryffyn, Trevor wrote:

Tango:

---------------------------------------------

En espa�ol:
�Usted habla ingl�s? Mucha gente en esta lista habla solamente ingl�s y ella 
puede no entender su pregunta. Estoy utilizando un software de la traducci�n 
(Babelfish) para intentar ayudar.

Recomiendo el usar de la funci�n del file() para leer la l�nea del archivo uno 
a la vez y para analizar la l�nea para ACTIVADO y DESACTIVADO. Puede ser que 
sea m�s f�cil y puede trabajar mejor.
http://us2.php.net/manual/es/function.file.php

Utilice quiz� la funci�n del trim() tambi�n.

Si�ntase por favor libre escribirme si esta soluci�n no trabaja. Puedo intentar 
ayudar. �Buena suerte!

---------------------------------------------

In English:
Do you speak english?  Many people on this list only speak english and they may 
not understand your question.   I am using a translation software (Babelfish) 
to try to help.

I recommend using the file() function to read the file one line at a time and 
parse the line for ACTIVADO and DESACTIVADO.  It might be easier and may work 
better.
http://us2.php.net/manual/es/function.file.php

Maybe use the trim() function also.

Please feel free to write to me if this solution does not work.  I can try to 
help.

Good luck!


-TG




-----Original Message-----
From: T4NG0 [mailto:[EMAIL PROTECTED] Sent: Monday, November 29, 2004 7:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Problemas con las igualdades



Listeros:

estoy tratando de establecer una igualdad y no logro comprender el funcionamiento, el c�digo es el siguiente.

dado X archivos en mi directorio cuyo contenido puerde ser "ACTIVADO", "DESACTIVADO" o "NULO".

yo debo determinar el contenido de ellos.
el problema es que yo logro ver bien el contenido del archivo y lo puedo mostrar sin problemas (esa parte del script no la pasti�) pero lo que no puedo hacer es determinar el contenido del archivo (la linea IF $leer == "ACTIVADO" me da o siempre falso o siempre verdadero pero nunca logro obtener un resultado coherente... ni con = ni con == ni con ===)


alguna idea gente ??

supongo que dada la hora mis neuronas ya no quieren funcionar y no veo cual es la pavada que me esta deteniendo...


for ($x = 40; $x< 154; $x++) { [EMAIL PROTECTED]("./ws$x",'r'); $leer = @fread($fp, 8192);

 settype($leer, "string");

 if ($leer=="ACTIVADO")
 {
   echo "ACTIVADO";
 } else {
   echo "DESACTIVADO";
 }
}


gracias y Saludos


Gast�n.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php








-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to