praveenhotha Posted August 17, 2006 Share Posted August 17, 2006 foreach($users as $value) { $key=strcmp($search,$value); if($key==0) { reset($users); print("<br>Welcome click to view my pages"); print("<a href='TestPraveenSession.php'>next page</a>"); } }I am trying to compare 2 strings, using strcmp, so how shud the values be given, it is always giving me false, eventhough i gave the same strings in both the arguments. Quote Link to comment Share on other sites More sharing options...
trq Posted August 17, 2006 Share Posted August 17, 2006 strcmp returns 0 when the strings are equal. Quote Link to comment Share on other sites More sharing options...
Jeremysr Posted August 17, 2006 Share Posted August 17, 2006 Use the == operator instead.[code=php:0]if ($search == $value)[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.