UnknownPlayer Posted June 5, 2010 Share Posted June 5, 2010 When i wonna test: $text1 = "This"; $text2 = "This"; if ($text1 == $text2) - true it works when text is same, but when i wonna test this one: $text1 = "This"; $text2 = "this"; if ($text1 == $text2) - false it is true but "T" char is first var i upper, but in second var "t" is lower, how can i get that both are true, i mean how can i test this string, but with upper and lower? Link to comment https://forums.phpfreaks.com/topic/203964-checking-strings-help/ Share on other sites More sharing options...
kenrbnsn Posted June 5, 2010 Share Posted June 5, 2010 You could use strcasecmp or you could do <?php $text1 = "This"; $text2 = "this"; if (strtolower($text1) == strtolower($text2)) ?> Ken Link to comment https://forums.phpfreaks.com/topic/203964-checking-strings-help/#findComment-1068248 Share on other sites More sharing options...
UnknownPlayer Posted June 5, 2010 Author Share Posted June 5, 2010 This will work when i get some string values from mysql and put in this function ? Link to comment https://forums.phpfreaks.com/topic/203964-checking-strings-help/#findComment-1068275 Share on other sites More sharing options...
kenrbnsn Posted June 5, 2010 Share Posted June 5, 2010 Yes, it should. String values are string values, no matter how they are obtained. Ken Link to comment https://forums.phpfreaks.com/topic/203964-checking-strings-help/#findComment-1068277 Share on other sites More sharing options...
UnknownPlayer Posted June 5, 2010 Author Share Posted June 5, 2010 Thanks xD Link to comment https://forums.phpfreaks.com/topic/203964-checking-strings-help/#findComment-1068278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.