Need help badly in php file(); function
i have created a function which checks for username if it is present in users.txt (where each name is in a new line) file or not but the if condition $name == $userid isn't giving true value even for identical names. <?php //Check if user exists or not... $user = $_GET['userid']; $flag = $_GET['flag']; if($flag=='true'){checkuser($user);} function checkuser($userid){ echo 'chk user started with name '.$userid.'<br />'; //echo 'check user function started'; $userlist = file("users/users.txt"); foreach ($userlist as $name) { //getting problem in below line... if ($name == $userid) { if($flag!=='true'){return true;} else { echo "true"; //break; } } else {echo 'user not '.$name.' but '.$userid.'<br /> ';} } } ?> any help would be really appreciated thanks