Solved

how can i search a sentince in onther sentince?

Posted on 2008-10-01
2
226 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 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