473,769 Members | 5,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Duplicate array strings

$rambo[1]="daffy duck";
$rambo[2]="mad max";
$rambo[3]="daffy duck";
$rambo[4]="superman";
etc etc

How do i remove duplicate strings from a array ? .

('daffy duck' could appear more than twice in the array)

I can already do it via a luddite loop - but figure there must be a
better/easier way of doing it .
--
(stuckle and his lapdogs are forbidden from replying to this thread as i
dont actually want any help from them)
Nov 5 '07 #1
10 2091
On Mon, 5 Nov 2007 17:24:39 -0000, Krustov <me@privacy.net wrote:
>$rambo[1]="daffy duck";
$rambo[2]="mad max";
$rambo[3]="daffy duck";
$rambo[4]="superman";
etc etc

How do i remove duplicate strings from a array ? .

('daffy duck' could appear more than twice in the array)

I can already do it via a luddite loop - but figure there must be a
better/easier way of doing it .
>(stuckle and his lapdogs are forbidden from replying to this thread as i
dont actually want any help from them)
You don't deserve an answer at all then.
--
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/ http://www.pherber.com/
Nov 5 '07 #2
Paul Herber wrote:
On Mon, 5 Nov 2007 17:24:39 -0000, Krustov <me@privacy.net wrote:
>$rambo[1]="daffy duck";
$rambo[2]="mad max";
$rambo[3]="daffy duck";
$rambo[4]="superman";
etc etc

How do i remove duplicate strings from a array ? .

('daffy duck' could appear more than twice in the array)

I can already do it via a luddite loop - but figure there must be a
better/easier way of doing it .
>(stuckle and his lapdogs are forbidden from replying to this thread as i
dont actually want any help from them)

You don't deserve an answer at all then.
Dito.

While Jerry can be quite harsh from time to time, he is also damned good
with PHP, and what is more: an active usefull contributor to this group.
comp.lang.php wouldn't be the same without him. ;-)

/me salutes Jerry.

Erwin Moller
Nov 5 '07 #3
Krustov <me@privacy.net wrote in news:MPG.219962 218a7d76d398af1 9
@news.newsreade r.com:
(stuckle and his lapdogs are forbidden from replying to this thread as i
dont actually want any help from them)
cool, is that drowning in a lake and demanding that certain people be
excluded from tossing you a life preserver?

drown idiot, drown.
Nov 5 '07 #4
Krustov <me@privacy.net wrote in news:MPG.219962 218a7d76d398af1 9
@news.newsreade r.com:

How do i remove duplicate strings from a array ? .
RTFMAMF

Nov 5 '07 #5
..oO(Krustov)
>$rambo[1]="daffy duck";
$rambo[2]="mad max";
$rambo[3]="daffy duck";
$rambo[4]="superman";
etc etc

How do i remove duplicate strings from a array ? .
RTFM.
>(stuckle and his lapdogs are forbidden from replying to this thread as i
dont actually want any help from them)
Go away.

Micha
Nov 5 '07 #6
On Mon, 05 Nov 2007 18:24:39 +0100, Krustov <me@privacy.net wrote:
$rambo[1]="daffy duck";
$rambo[2]="mad max";
$rambo[3]="daffy duck";
$rambo[4]="superman";
etc etc

How do i remove duplicate strings from a array ? .
The manual is quite elusive isn't it?
--
Rik Wasmus
Nov 5 '07 #7
As a regular Stuckle follower/lapdog/whatever I would have suggested
you use:

array_intersect or related array searching commands such as:

array_intersect _assoc()
array_diff()
array_diff_asso c()

So if you do not wish to taint yourself with Stuckle advice, I'd
suggest refraining from using any of the above functions.

Have a great day!

Nov 7 '07 #8
On Wed, 07 Nov 2007 02:57:47 +0100, <la***@portcomm odore.comwrote:
array_intersect or related array searching commands such as:

array_intersect _assoc()
array_diff()
array_diff_asso c()
Euhm, well, array_unique() I'd say...
--
Rik Wasmus
Nov 7 '07 #9
Rik Wasmus wrote:
On Wed, 07 Nov 2007 02:57:47 +0100, <la***@portcomm odore.comwrote:
>array_intersec t or related array searching commands such as:

array_intersec t_assoc()
array_diff()
array_diff_ass oc()

Euhm, well, array_unique() I'd say...
Let's ask Jerry.
;-)

Regards,
Erwin Moller
Nov 7 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
13840
by: Robert | last post by:
Im a beginner in PHP and Im having a problem with this code. Im trying to remove duplicate elements from an array created via $_GET. I want users to be able to click on a link which sends an email address to an array. I just want to remove duplicate email addresses from the array. Ive tried array_unique() on my test server but it doesnt work. So i tried to remove duplicates myself before storing them into the array. The script works...
3
3223
by: Giloosh | last post by:
Hello, i need some help if possible... i have a payments table with over 500 records i want to run a query that searches through the table spotting out any duplicate ID#'s and Dates. So basically it will run a search spotting out duplicate ID#'s. Than with in those ID#'s spot out duplicate dates. I could do this by eye and spend hours spotting out the duplicated dates, but it would be much easier and funner having a script do it for you.
9
3017
by: NiQ | last post by:
Hello every one, this is about an array of string and may be have done several time before but i need it and wasnt able to find it so here is the problem i have an array of strings with contains words and i want a distinct list of array with the count of each number repeat i.e how many time it exist in the array and the final result should be sorted according to the number of repeat from hight to low . for example
7
23936
by: Voetleuce en fênsievry | last post by:
Hello everyone. I'm not a JavaScript author myself, but I'm looking for a method to remove duplicate words from a piece of text. This text would presumably be pasted into a text box. I have, for example, a list of town names, but there are hundreds of duplicates, like: "Aberdeen Aberdeen Aberdeen Edinburg Edinburg Inverness etc."
2
1485
by: Trond | last post by:
I have been trying to fig out how to build up an array with dates. When its generated i want to be able to remove duplicate dates. The dates is generated by FileInfo object that is scanning a folder for files. Here is some code for that. In this case i am only using a variable not an array. _info = new FileInfo(_fileName); base.Text = _info.LastWriteTime.ToShortDateString(); As i see it i must first generate the array with dates. Then...
9
5100
by: vbportal | last post by:
Hi, I would like to add BitArrays to an ArrayList and then remove any duplicates - can someone please help me forward. I seem to have (at leaset ;-) )2 problems/lack of understanding (see test code below): (a)When adding BitArrays to the ArrayList and then looping through the ArrayList I seem to access only the latest added BitArray and I'm not exactly clear on best way to access each BItArray in the ArrayList (b)When I try to remove...
2
22608
by: Potiuper | last post by:
Question: Is it possible to use a char pointer array ( char *<name> ) to read an array of strings from a file in C? Given: code is written in ANSI C; I know the exact nature of the strings to be read (the file will be written by only this program); file can be either in text or binary (preferably binary as the files may be read repeatedly); the amount and size of strings in the array won't be known until run time (in the example I have it in...
1
16609
by: JTreefrog | last post by:
Hello - I've read a ton of stuff about deleting duplicate values in an array. They are all very useful - they just haven't addressed an array of objects. Here's my array: var sDat = ; The array is produced from JSON sent to me from a database query. I can't do a "group by" in the sql query - i actually need the repeats in a different array. Anyway - I want to be able to remove duplicate sDat.sid entries in my sDat array - but I'm...
5
2352
by: raviufor | last post by:
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include <ctype.h> #include <ctype.h> #include <time.h> #include <sys/types.h>
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.