Jump to content

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);
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.