Click here to get back home

string comparison in php

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
string comparison in php Sudhakar 07-14-2008
Get Chitika Premium
Posted by Sudhakar on July 14, 2008, 4:33 am
Please log in for more thread options
hi

i am writing a small application where a user enters a phrase in the
textfield and i would like to display all the files present in the
root directory which consists of the keyword or keywords entered by
the user.

i have used a few comparison functions but i am not getting the
expected result.

$my_file = file_get_contents("filename.html");
what ever the user enters whether it is a single word or few words i
would like to compare with $my_file in a case insensitive manner.

can anyone suggest the best method and how to go about.

thanks.

Posted by BigZero on July 14, 2008, 5:10 am
Please log in for more thread options
> hi
>
> i am writing a small application where a user enters a phrase in the
> textfield and i would like to display all the files present in the
> root directory which consists of the keyword or keywords entered by
> the user.
>
> i have used a few comparison functions but i am not getting the
> expected result.
>
> $my_file = file_get_contents("filename.html");
> what ever the user enters whether it is a single word or few words i
> would like to compare with $my_file in a case insensitive manner.
>
> can anyone suggest the best method and how to go about.
>
> thanks.

i think the Reg_Expression works for u.



VM

Posted by sathyashrayan on July 14, 2008, 5:17 am
Please log in for more thread options

> hi
>
> i am writing a small application where a user enters a phrase in the
> textfield and i would like to display all the files present in the
> root directory which consists of the keyword or keywords entered by
> the user.
>
> i have used a few comparison functions but i am not getting the
> expected result.
>
> $my_file = file_get_contents("filename.html");
> what ever the user enters whether it is a single word or few words i
> would like to compare with $my_file in a case insensitive manner.
>
> can anyone suggest the best method and how to go about.
>
> thanks.

http://in2.php.net/manual/en/class.dir.php

Look for the "User Contributed Notes" at the end.

do search for "auto suggest" in search..



Posted by Jerry Stuckle on July 14, 2008, 7:35 am
Please log in for more thread options
Sudhakar wrote:
> hi
>
> i am writing a small application where a user enters a phrase in the
> textfield and i would like to display all the files present in the
> root directory which consists of the keyword or keywords entered by
> the user.
>
> i have used a few comparison functions but i am not getting the
> expected result.
>
> $my_file = file_get_contents("filename.html");
> what ever the user enters whether it is a single word or few words i
> would like to compare with $my_file in a case insensitive manner.
>
> can anyone suggest the best method and how to go about.
>
> thanks.
>

This can get complicated quickly. If they enter one word, you can
easily search each file for that word. If they enter two words, what if
those words appear, but not together?

Either way, you will need to open each file, read it into memory and
search it. You can do it in your PHP program, but you might find it
faster to execute grep and let the system do it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================


Similar ThreadsPosted
String comparison problem... March 20, 2005, 4:49 pm
string similarity comparison April 22, 2005, 10:41 pm
String comparison problems June 30, 2006, 9:30 pm
Re: Odd String Comparison Problem March 15, 2008, 9:32 am
Database Comparison? September 14, 2004, 5:04 am
Difference between == and === comparison March 11, 2005, 7:37 pm
Array comparison September 9, 2006, 11:39 pm
Comparison of board software November 11, 2005, 4:04 pm
PHP v Python: fair comparison? November 2, 2006, 10:21 am
Array comparison question April 2, 2007, 5:29 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap