473,385 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Best way to subtract one word set from another ?

290 100+
Hi

I have an array of common words:
$common = array(a,the,about,is,from,to,go);

and a string that is a long paragraph of words.
$words
(It could of course be turned into and array as well.)

What I want to do is to remove the common words from my
string and I am not sure if I should do this with a regex, or a foreach loop
or if there is a particular array function that would suit the purpose.

I have looked through the array function list but can not see anything
specifically for this. I could perhaps use the change $words into an array
and use the in_array($words)

What would you recommend as the best way to do this ?
Nov 6 '09 #1
2 2355
Dormilich
8,658 Expert Mod 8TB
@jeddiki
thoroughly read PHP’s array functions descriptions. (hint: array_diff())
Nov 6 '09 #2
jeddiki
290 100+
Thanks for the pointer :)
Nov 6 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: O Ransen | last post by:
Hello all, I hope you can help me. Given graphical idea for a page: http://www.ransen.com/temp/temp.htm (Large image, please be patient!) What is the best way of constructing this page...
3
by: ReidarT | last post by:
I have a javascript where I try to add 1 to a value through a button and show the value in a textbox and subtract 1 from another button and show the result in the same textfield. This seems to...
2
by: valinor | last post by:
Hi guys, (rather lengthy...) I'm trying to speed up the time spent on a postfilter for video. YUV 4:2:0 data, each pixel is 1 byte (0-255) The basic idea is to filter one pixel on each side...
2
by: Fabian | last post by:
Friends, I´m making a basic system for sale spare parts cars and have a problem to subtract my new stock against sale on the day. Is possible use a basic consult and foms or necessary I need...
3
by: Russell | last post by:
Hey, ok i have numerous tables to search through for a 'site search'. some of the searchble fields have html embeded within so after some quick referencing, saw I can use the regExp function...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
10
by: Robert R. | last post by:
Hello, i would like to write a piece of code to help me to align some sequence of words and suggest me the ordered common subwords of them s0 = "this is an example of a thing i would like to...
8
by: Remington | last post by:
I am using windows 2000pro with access 2000. I am trying to make a database for our HR department, that would allow our HR Director to type in an employee's ID number into a form and then select...
6
by: pj | last post by:
Hi, I 'm currently writing a program that performs transliteration (i.e., converts greek text written using the english alphabet to "pure" greek text using the greek alphabet) as part of my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.