Duplicate array strings
am 05.11.2007 18:24:39 von Hans-Peter Sauer
$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)
Re: Duplicate array strings
am 05.11.2007 19:19:17 von Paul Herber
On Mon, 5 Nov 2007 17:24:39 -0000, Krustov 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/
Re: Duplicate array strings
am 05.11.2007 19:39:48 von Erwin Moller
Paul Herber wrote:
> On Mon, 5 Nov 2007 17:24:39 -0000, Krustov 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
Re: Duplicate array strings
am 05.11.2007 19:48:45 von Good Man
Krustov wrote 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.
Re: Duplicate array strings
am 05.11.2007 20:01:41 von Up Yours
Krustov wrote in news:MPG.219962218a7d76d398af19
@news.newsreader.com:
> How do i remove duplicate strings from a array ? .
RTFMAMF
Re: Duplicate array strings
am 05.11.2007 20:28:29 von Michael Fesser
..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
Re: Duplicate array strings
am 05.11.2007 21:41:54 von luiheidsgoeroe
On Mon, 05 Nov 2007 18:24:39 +0100, Krustov wrote:
> $rambo[1]=3D"daffy duck";
> $rambo[2]=3D"mad max";
> $rambo[3]=3D"daffy duck";
> $rambo[4]=3D"superman";
> etc etc
>
> How do i remove duplicate strings from a array ? .
The manual is quite elusive isn't it?
-- =
Rik Wasmus
Re: Duplicate array strings
am 07.11.2007 02:57:47 von Larry Anderson
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!
Re: Duplicate array strings
am 07.11.2007 08:20:02 von luiheidsgoeroe
On Wed, 07 Nov 2007 02:57:47 +0100, wrote:
> 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
Re: Duplicate array strings
am 07.11.2007 09:40:06 von Erwin Moller
Rik Wasmus wrote:
> On Wed, 07 Nov 2007 02:57:47 +0100, wrote:
>> 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
Re: Duplicate array strings
am 07.11.2007 13:45:37 von Hans-Peter Sauer
<47317b21$0$242$e4fe514c@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)