Solved

how can i search a sentince in onther sentince?

Posted on 2008-10-01
2
217 Views
Last Modified: 2012-05-05
for example i have this sentince "good hall sdff " and i want to search for it in "the hall of fim is good"
and to give me true

and please i dont want it using exploade beacuse i know how to do it in exploade but it is slow
0
Comment
Question by:mgtm3
2 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 350 total points
ID: 22614142
$string="the hall of fame is good";
if( FALSE !==stripos($string,"good hall fame" ) )
{
 echo "found";
}

NOTE: The above will do a case INSENSITVE comparison. If you want a case sensitive comparison use:
strpos()
0
 
LVL 3

Assisted Solution

by:smueller72
smueller72 earned 150 total points
ID: 22614171
if you don't want to hard code it in the code (you want to work on text given by an input box or similar), you need a 'fuzzy search' class such as the following:
http://elonen.iki.fi/code/misc-notes/appr-search-php/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now