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! Link to comment https://forums.phpfreaks.com/topic/217852-find-a/ 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 Link to comment https://forums.phpfreaks.com/topic/217852-find-a/#findComment-1130694 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. Link to comment https://forums.phpfreaks.com/topic/217852-find-a/#findComment-1130695 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 ) Link to comment https://forums.phpfreaks.com/topic/217852-find-a/#findComment-1130696 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 Link to comment https://forums.phpfreaks.com/topic/217852-find-a/#findComment-1130699 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 Link to comment https://forums.phpfreaks.com/topic/217852-find-a/#findComment-1130701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.