Jump to content

[SOLVED] Difficult Array Question


phpretard

Recommended Posts

I have 2 arrays:

I need to compair the values, pull out the values that match an then make a seperate array for matching values.

 


Array ( [0] => 41bab296a65b71736b464f8aff39b342 [1] => 41bab296a65b71736b464f8aff39b342 [2] => 66251a6dd00d06827bb7c2e3c01bcf08 ) 

Array ( [0] => 07c38f09cdbd199bb39282667360b817 [1] => 66251a6dd00d06827bb7c2e3c01bcf08 [2] => 74134b63b6d0dbbf4f0157aafab505b6 ) 

So the new array would be:

Array ( [0] => 66251a6dd00d06827bb7c2e3c01bcf08 ) 

The new array is what I can't figure out the code for.

 

I hope someone can help!

 

Thank you.

 

Anthony

Link to comment
https://forums.phpfreaks.com/topic/160300-solved-difficult-array-question/
Share on other sites

Are you saying something like this?

 

<?php
$array1 = array('41bab296a65b71736b464f8aff39b342','41bab296a65b71736b464f8aff39b342','66251a6dd00d06827bb7c2e3c01bcf08');
$array2 = array('07c38f09cdbd199bb39282667360b817','66251a6dd00d06827bb7c2e3c01bcf08','74134b63b6d0dbbf4f0157aafab505b6');

foreach($array1 AS $one){
foreach($array2 AS $two){
	if($one == $two){
		$new = array($two);
	}
}
}

print_r($new);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.