My problem:
I have an array called $ ownerArray that needs to be checked by another array, and if there is a key in both arrays that displays the value of the corresponding key. $ ownerArray is populated with a database, so I can't just write the ir operator in an if statement.
$ ownerArray will look like this:
$ownerArray = array(0 =>'Name0',1 =>'Name1',2 =>'Name2',3 =>'Name3');
Then I have another array called $ Users, which has a different number of values depending on what the user selects, so $ Users might look like this:
$Users = '1,2'
or like this:
$Users = '1,3'
$ Users are never the same.
But I need $ value $ ownerArray to display if any of the $ Users integer values matches any $ key from $ ownerArray
Example:
foreach($ownerArray as $key => $value)
{
if(in_array($key,array($Users)))
{
print $value;
}
}
. , .
, $Users = '1,3' for Name1 Name3 $ownerArray.
!
ps , if ($ key == 1 || $key == 2), .