jwilson122 Posted November 5, 2010 Share Posted November 5, 2010 Hey, What function / how would I find if a string has something? Say I have a string like: $string = 'Hello their! This is my post btw, my name is Justin.'; Say I wanted to find out if my name "Justin" is inside that string.. so: whateverfunction('Justin', $string) So I think you should get my idea now though Thanks a lot! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 5, 2010 Share Posted November 5, 2010 stristr() is probably the simplest. http://php.net/manual/en/function.stristr.php Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 5, 2010 Share Posted November 5, 2010 The functions strpos and strstr come to mind. Quote Link to comment Share on other sites More sharing options...
jwilson122 Posted November 5, 2010 Author Share Posted November 5, 2010 stristr() is probably the simplest. http://php.net/manual/en/function.stristr.php Oh Okay thanks! Anyone know of a easier way? (Even though this is pretty dang easy LOL.. just gotta remember it ) Quote Link to comment Share on other sites More sharing options...
jwilson122 Posted November 5, 2010 Author Share Posted November 5, 2010 The functions strpos and strstr come to mind. Oh ok thanks also! Will look into these as well Quote Link to comment Share on other sites More sharing options...
rwwd Posted November 5, 2010 Share Posted November 5, 2010 if(preg_match("\justin\im", $input)){ echo "match"; exit; } Something along that line; sorry if it's wrong, but I am off to get coffee now, but you get the idea.. Rw Quote Link to comment 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.