Find where arrays overlap

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Find where arrays overlap

Postby harmlessgoat22 » 30 Jul 2008, 13:17

Is there a way of finding where arrays overlap? Like if I have...
array(1,2,3) and array(2,3,4)...they would overlap at array(2,3).

Could you do something like $array1 - $array2 = $array3. $overlap = $array1 - $array3; ??? Would that work, or can't you do that with arrays...
Logic behind above... (1,2,3) - (2,3,4) would produced (1) (hopefully). THen, (1,2,3) - (1) = overlap (2,3)

Else, is there another way?

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
Lord Le Brand
Website Team
Website Team
Posts: 223
Joined: 08 Sep 2006, 15:44
Real name: Leroy
Location: Parkstad, Limburg, the Netherlands (GMT+1)
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Find where arrays overlap

Postby Lord Le Brand » 30 Jul 2008, 13:48


harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: Find where arrays overlap

Postby harmlessgoat22 » 30 Jul 2008, 17:54

Yes, I saw that, but I didn't think it could do what I was asking, but looking at it again, I think it can. Thank you!

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “phpBB Development discussion”

Who is online

Users browsing this forum: No registered users and 34 guests