phpbar.de logo

Mailinglisten-Archive

[php] =?iso-8859-1?Q?Re:_=5Bphp=5D_In_einem_Array_doppelte_Eintr=E4ge_l=F6sch?= =?iso-8859-1?Q?en=3F?=

[php] Re: [php] In einem Array doppelte Einträge lösch en?

QUAD php_(at)_phpcenter.de
Tue, 10 Apr 2001 16:27:23 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0144_01C0C1DB.1F283060
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

  ----- Original Message -----=20
  From: David Klein|BOheads=20
  Das Array wird gefuellt mit array_push($list,$neu)
  Jetzt will ich aber nicht ein Array haben das so aussieht->
  15,39,89,15,78,89
  sondern eins das alle doppelten l=F6scht damits so aussieht->
  15,39,89,78
Hier, das sollte wohl die schnellste L=F6sung sein.Viel Spass damit !

// START

$array_new =3D array();
$array_org =3D array(15,16,15,17,18,15,16,18,17,19,20);
foreach ($array_org as $list) {if(!in_array($list,$array_new)) =
array_push($array_new,$list);}

// UND BITTE PRINTEN ;o)
$org =3D join(',',$array_org);
$new =3D join(',',$array_new);
print "Org.: $org<P> New: $new<P>";

// ENDE


--=20
Tino Ehrich
application designer
goto IT-Solutions GmbH
Wilhelm-Wagenfeld-Stra=DFe 1
13086 Berlin
=20
Tel. +49 30.92.401 -555
Fax  +49 30.92.401 -599
Mobile  +49.172.600.62.02
mailto: tehrich_(at)_goto-it.de
ICQ     #103290811
_________________________________________________
The information contained in this message is for
the intended addressee only and may contain
confidential and/or privileged information.
If you are not the intended addressee, please
delete this message and notify the sender; do not
copy or distribute this message or disclose its
contents to anyone. Any views or opinions expressed
in this message are those of the author and do not
necessarily represent those of CH-850 [global media]
or of any of its associated companies.  No reliance
may be placed on this message without written
confirmation from an authorised representative
of the company !
_________________________________________________


------=_NextPart_000_0144_01C0C1DB.1F283060
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3103.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A href=3D"mailto:d.klein_(at)_boheads.de" title=3Dd.klein_(at)_boheads.de>David =

  Klein|BOheads</A> </DIV>
  <DIV><FONT face=3DArial size=3D2>Das Array wird gefuellt mit=20
  <STRONG><EM>array_push(</EM></STRONG>$list,$neu)</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Jetzt will ich aber nicht ein Array =
haben das so=20
  aussieht-&gt;</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>15,39,89,15,78,89</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>sondern eins das alle doppelten =
l=F6scht damits so=20
  aussieht-&gt;</FONT></DIV>
  <DIV><FONT face=3DArial =
size=3D2>15,39,89,78</FONT></DIV></BLOCKQUOTE></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Hier, das sollte wohl die schnellste =
L=F6sung=20
sein.Viel Spass damit !</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>// START</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>$array_new =3D array();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$array_org =3D=20
array(15,16,15,17,18,15,16,18,17,19,20);</DIV></FONT>
<DIV><FONT face=3DArial size=3D2>foreach ($array_org as $list)=20
{if(!in_array($list,$array_new)) =
array_push($array_new,$list);}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>// UND BITTE PRINTEN </FONT><FONT =
face=3DArial=20
size=3D2>;o)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$org =3D join(',',$array_org);<BR>$new =
=3D=20
join(',',$array_new);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>print "Org.: $org&lt;P&gt; New:=20
$new&lt;P&gt;";<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>// ENDE</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT>
<DIV><FONT face=3DArial size=3D2>-- <BR>Tino Ehrich<BR>application =
designer<BR>goto=20
IT-Solutions GmbH<BR>Wilhelm-Wagenfeld-Stra=DFe 1<BR>13086=20
Berlin<BR>&nbsp;<BR>Tel. +49 30.92.401 -555<BR>Fax&nbsp; +49 30.92.401=20
-599<BR>Mobile&nbsp; +49.172.600.62.02<BR>mailto: <A=20
href=3D"mailto:tehrich_(at)_goto-it.de">tehrich_(at)_goto-it.de</A><BR>ICQ&nbsp;&nb=
sp;&nbsp;&nbsp;=20
#103290811<BR>_________________________________________________<BR>The=20
information contained in this message is for<BR>the intended addressee =
only and=20
may contain<BR>confidential and/or privileged information.<BR>If you are =
not the=20
intended addressee, please<BR>delete this message and notify the sender; =
do=20
not<BR>copy or distribute this message or disclose its<BR>contents to =
anyone.=20
Any views or opinions expressed<BR>in this message are those of the =
author and=20
do not<BR>necessarily represent those of CH-850 [global media]<BR>or of =
any of=20
its associated companies.&nbsp; No reliance<BR>may be placed on this =
message=20
without written<BR>confirmation from an authorised representative<BR>of =
the=20
company=20
!<BR>_________________________________________________<BR></DIV></FONT></=
BODY></HTML>

------=_NextPart_000_0144_01C0C1DB.1F283060--



php::bar PHP Wiki   -   Listenarchive