The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 02:10:36 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Comparing Arrays  (Read 3631 times)
SEOidiot
Journeyman
***
Offline Offline

Posts: 84


^ Hes a pint sized Ned Flanders


View Profile
« on: October 19, 2008, 11:50:51 AM »

Lets say I have 2 arrays and need to compare them and output just those items from array1 that dont now appear in array2


any ideas?

brain fading..... shutting dow....... beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeep
Logged

<mango>Yummmmmmmmmmmmm</mango>
<pie>ewwwwwwwwwww</pie>
SEOidiot
Journeyman
***
Offline Offline

Posts: 84


^ Hes a pint sized Ned Flanders


View Profile
« Reply #1 on: October 19, 2008, 11:52:57 AM »

Hi Paul,

How about http://www.w3schools.com/PHP/func_array_diff.asp

for example?
Logged

<mango>Yummmmmmmmmmmmm</mango>
<pie>ewwwwwwwwwww</pie>
SEOidiot
Journeyman
***
Offline Offline

Posts: 84


^ Hes a pint sized Ned Flanders


View Profile
« Reply #2 on: October 19, 2008, 11:53:55 AM »

Hey SEOidiot,

Yeah that looks like the kinda thing, thanks matey  Applause

God i love this forum..
Logged

<mango>Yummmmmmmmmmmmm</mango>
<pie>ewwwwwwwwwww</pie>
SEOidiot
Journeyman
***
Offline Offline

Posts: 84


^ Hes a pint sized Ned Flanders


View Profile
« Reply #3 on: October 19, 2008, 11:54:29 AM »

   D'oh!  Jackoff Wink
Logged

<mango>Yummmmmmmmmmmmm</mango>
<pie>ewwwwwwwwwww</pie>
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: October 19, 2008, 11:54:50 AM »

G'day my friend... that would do you.

I just got back late last night, still not quite human. I'll post and catch up in a bit, glad to see you about Smiley
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: October 19, 2008, 11:55:52 AM »

By the way, noticing that there's barely 1 minute between each posts, I see that your multiple personality problem has gotten worse.
Perhaps you might want to get that all of them looked at.

Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
SEOidiot
Journeyman
***
Offline Offline

Posts: 84


^ Hes a pint sized Ned Flanders


View Profile
« Reply #6 on: October 19, 2008, 12:08:48 PM »

Would have been quicker but im running Laura a bath Smiley

Ping me when youre settled back in
Logged

<mango>Yummmmmmmmmmmmm</mango>
<pie>ewwwwwwwwwww</pie>
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #7 on: October 19, 2008, 12:23:38 PM »

10-4 ... cripes the amount of email/thread/post/client need over here is deafening. Looks like it's shaping up into a busy week...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #8 on: October 24, 2008, 07:19:19 AM »

This will print the items in array1 that are NOT in array2

Code:
@array1 = (one, two, three, four);
@array2 = (one, two, three);

foreach $item (@array1) {
  unless( grep(/$item/, @array2) ) { print "$item\n"; }
}

Prints: four


this is the perl board, right?



   
« Last Edit: October 24, 2008, 07:27:48 AM by Bompa » Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #9 on: October 24, 2008, 08:58:13 AM »

Applause  Roll Eyes



ROFLMAO
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!