Re: [PHP] How to compare 2 strings

2003-02-04 Thread Krzysztof Dziekiewicz
 How to compare 2 strings in PHP
 I hawe 2 array where I have only string values some values in both arrays
 are same but if command don't send me a good result.
 e.g

 foreach ($array1 as $a1) {
   foreach($array2 as $a2){
if ($a1 == $a2) echo good;   //never system send me a good result
  else echo bad;
   }
 }

If you have in one array test and in the other also test
(not Test nor TEST but test) it must work.

By the way in
   else echo bad;
you have not got a quotation mark after bad.


-- 
Krzysztof Dziekiewicz


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




[PHP] How to compare 2 strings

2003-02-03 Thread Roman Duriancik
How to compare 2 strings in PHP
I hawe 2 array where I have only string values some values in both arrays
are same but if command don't send me a good result.
e.g

foreach ($array1 as $a1) {
  foreach($array2 as $a2){
   if ($a1 == $a2) echo good;   //never system send me a good result
 else echo bad;
  }
}


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




RE: [PHP] How to compare 2 strings

2003-02-03 Thread Matt Schroebel


 -Original Message-
 From: Roman Duriancik [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, February 03, 2003 9:31 AM

 Subject: [PHP] How to compare 2 strings
 

 How to compare 2 strings in PHP
 I hawe 2 array where I have only string values some values in 
 both arrays
 are same but if command don't send me a good result.
 e.g
 
 foreach ($array1 as $a1) {
   foreach($array2 as $a2){
if ($a1 == $a2) echo good;   //never system send me a good result
  else echo bad;
   }
 }

See Strcmp()

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




Re: [PHP] How to compare 2 strings

2003-02-03 Thread 1LT John W. Holmes
 How to compare 2 strings in PHP
 I hawe 2 array where I have only string values some values in both arrays
 are same but if command don't send me a good result.
 e.g

 foreach ($array1 as $a1) {
   foreach($array2 as $a2){
if ($a1 == $a2) echo good;   //never system send me a good result
  else echo bad;
   }
 }

Well, that means your strings are never equal, plain and simple. Remember
the comparison will be case sensitive. You should be using strcmp() and it's
family to compare strings, anyhow.

---John Holmes...


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