Solved

how can i search a sentince in onther sentince?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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 …

747 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

14 Experts available now in Live!

Get 1:1 Help Now