PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Duplicate array strings
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Duplicate array strings

Réponse
 
LinkBack Outils de la discussion
Vieux 05/11/2007, 17h24   #1
Krustov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 from them)
  Réponse avec citation
Vieux 05/11/2007, 18h19   #2
Paul Herber
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

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 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/
  Réponse avec citation
Vieux 05/11/2007, 18h39   #3
Erwin Moller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

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 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
  Réponse avec citation
Vieux 05/11/2007, 18h48   #4
Good Man
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

Krustov <me@privacy.net> 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 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.
  Réponse avec citation
Vieux 05/11/2007, 19h01   #5
Up Yours
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

Krustov <me@privacy.net> wrote in news:MPG.219962218a7d76d398af19
@news.newsreader.com:


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


RTFMAMF

  Réponse avec citation
Vieux 05/11/2007, 19h28   #6
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

..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 from them)


Go away.

Micha
  Réponse avec citation
Vieux 05/11/2007, 20h41   #7
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

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
  Réponse avec citation
Vieux 07/11/2007, 01h57   #8
larry@portcommodore.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Duplicate array strings

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!

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h17.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17914 seconds with 16 queries