yusufali Posted August 16, 2012 Share Posted August 16, 2012 okay so i have a txt file were the first line is awaldock $cheat_names = file('cheaters.txt'); thus print_r($cheat_names[0]); returns awaldock now i have another variable that i have stored a string parsed from an html file called $roster where $roster[1] = awaldock"> awaldock (2432) 2View | View0 print_r($roster[1]); returns the correct value yet when i do $l = strstr((String)$roster[1],(String)$cheat_names[0]); $l returns false how can i fix this, because i know the search string is in the string. Quote Link to comment https://forums.phpfreaks.com/topic/267185-problem-with-strstr/ Share on other sites More sharing options...
yusufali Posted August 16, 2012 Author Share Posted August 16, 2012 #edit i noticed that when there are more than one lines of text in the text file, it does not work yet when 'awaldock' is the only line in the text file, it works why? Quote Link to comment https://forums.phpfreaks.com/topic/267185-problem-with-strstr/#findComment-1369936 Share on other sites More sharing options...
Pikachu2000 Posted August 16, 2012 Share Posted August 16, 2012 Did you trim() $cheatnames[0] to remove the trailing linefeed that's probably there? Quote Link to comment https://forums.phpfreaks.com/topic/267185-problem-with-strstr/#findComment-1369937 Share on other sites More sharing options...
yusufali Posted August 16, 2012 Author Share Posted August 16, 2012 yes, did a simple trim($cheat_names[0]); works fine thank you Quote Link to comment https://forums.phpfreaks.com/topic/267185-problem-with-strstr/#findComment-1369938 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.