Solved

how can i search a sentince in onther sentince?

Posted on 2008-10-01
2
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 look for a specific file type in a local or remote server directory using PHP.

695 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