troylamb Posted July 1, 2008 Share Posted July 1, 2008 I am new to PHP, but I want to write a little search tool in PHP for a website and I am having a ton of trouble with it. I don't understand the syntax enough or know of useful functions to call. The problem: I have a $title character which I want to scan and pick up the name in the title from a list of names I have in an array. My logic is below. Thanks in advance! ------------------------ $title = "some crazy title that has Bob in it that I am searching through"; $mylist = array("id1" => "Chis Pete", "id2" => "Bob Clinton", "id3" => "George Harris"); for ($mylist as $id => $name){ $myid = array_search($name,$title); } echo "$myid is the id number which has the name in the title!" ------------------------ Link to comment https://forums.phpfreaks.com/topic/112690-data-mining-and-search-in-php/ Share on other sites More sharing options...
br0ken Posted July 1, 2008 Share Posted July 1, 2008 I think the function strpos() could be of use to you. Sorry I can't be of more help but it's late and I'm just about to log off for the night! Link to comment https://forums.phpfreaks.com/topic/112690-data-mining-and-search-in-php/#findComment-578772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.