validating a string in php if only substring is true

Posted by Chris_45 on Stack Overflow See other posts from Stack Overflow or by Chris_45
Published on 2010-04-06T14:39:32Z Indexed on 2010/04/06 15:53 UTC
Read the original article Hit count: 309

Filed under:
|
|
|

How to validate a substring is true in PHP for example if user1 is in the string it should be true?

textfile:

user1 : pass1

user2 : pass2

user3 : pass3

if(in_array($_SERVER['user1'] . "\r\n", $textfile)){ //not the way want this to be true
  printf("Ok user1 is in this row somewhere");
}

© Stack Overflow or respective owner

Related posts about php

Related posts about strings