By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,680 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,680 IT Pros & Developers. It's quick & easy.

Duplicate array strings

P: n/a
$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
Share this Question
Share on Google+
10 Replies


P: n/a
On Mon, 5 Nov 2007 17:24:39 -0000, Krustov <me@privacy.netwrote:
>$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

P: n/a
Paul Herber wrote:
On Mon, 5 Nov 2007 17:24:39 -0000, Krustov <me@privacy.netwrote:
>$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

P: n/a
Krustov <me@privacy.netwrote in news:MPG.219962218a7d76d398af19
@news.newsreader.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

P: n/a
Krustov <me@privacy.netwrote in news:MPG.219962218a7d76d398af19
@news.newsreader.com:

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

Nov 5 '07 #5

P: n/a
..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

P: n/a
On Mon, 05 Nov 2007 18:24:39 +0100, Krustov <me@privacy.netwrote:
$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

P: n/a
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_assoc()

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

P: n/a
On Wed, 07 Nov 2007 02:57:47 +0100, <la***@portcommodore.comwrote:
array_intersect or related array searching commands such as:

array_intersect_assoc()
array_diff()
array_diff_assoc()
Euhm, well, array_unique() I'd say...
--
Rik Wasmus
Nov 7 '07 #9

P: n/a
Rik Wasmus wrote:
On Wed, 07 Nov 2007 02:57:47 +0100, <la***@portcommodore.comwrote:
>array_intersect or related array searching commands such as:

array_intersect_assoc()
array_diff()
array_diff_assoc()

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

Regards,
Erwin Moller
Nov 7 '07 #10

P: n/a
<comp.lang.php>
<Erwin Moller>
<Wed, 07 Nov 2007 09:40:06 +0100>
<47*********************@news.xs4all.nl>
array_intersect_assoc()
array_diff()
array_diff_assoc()
Euhm, well, array_unique() I'd say...

Let's ask Jerry.
;-)
$rambo=array_keys(array_flip($rambo));
--
(stuckle and his lapdogs are forbidden from replying to this thread as i
dont actually want any help from them)
Nov 7 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.