twilightnights Posted January 14, 2007 Share Posted January 14, 2007 I am having trouble googling this one...basically I want an if statement that does an action if two strings are the same like [code]{if($cat1[$i] == "")[/code]but I don't think == works correctly. Anyone know a method to do this? Link to comment https://forums.phpfreaks.com/topic/34139-how-to-check-if-two-strings-are-the-same/ Share on other sites More sharing options...
kenrbnsn Posted January 14, 2007 Share Posted January 14, 2007 Using the "==" is correct. If you're having a problem with a script, please post the source between [nobbc][code][/code][/nobbc] tags.Ken Link to comment https://forums.phpfreaks.com/topic/34139-how-to-check-if-two-strings-are-the-same/#findComment-160577 Share on other sites More sharing options...
twilightnights Posted January 14, 2007 Author Share Posted January 14, 2007 Ok thanks. I wasn't sure because I thought I was having problems a few days with the same thing but I somehow fixed it. Link to comment https://forums.phpfreaks.com/topic/34139-how-to-check-if-two-strings-are-the-same/#findComment-160579 Share on other sites More sharing options...
rockinaway Posted January 14, 2007 Share Posted January 14, 2007 If you want to check it is identical then use === (3 equal signs) Link to comment https://forums.phpfreaks.com/topic/34139-how-to-check-if-two-strings-are-the-same/#findComment-160582 Share on other sites More sharing options...
emehrkay Posted January 14, 2007 Share Posted January 14, 2007 === is to check datatypes. so it cchecks to see if the left is the same datatype as the right$x = 9;$y = '9';$x == $y is true$x === $y is false Link to comment https://forums.phpfreaks.com/topic/34139-how-to-check-if-two-strings-are-the-same/#findComment-160584 Share on other sites More sharing options...
rockinaway Posted January 14, 2007 Share Posted January 14, 2007 Oh sorry, learning ... :-[ Link to comment https://forums.phpfreaks.com/topic/34139-how-to-check-if-two-strings-are-the-same/#findComment-160651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.