I'm passing data from my controller to view, I have code in my view
foreach ($mapData as $map)
{
echo $map['x'].';'.$map['y'].'<br/>';
}
And it prints me something like
5;5
6;6
7;7
Now, I am passing another data from my database as a two-dimensional array which looks like something like this
Array
(
[0] => Array
(
[x] => 5
[y] => 4
)
[1] => Array
(
[x] => 5
[y] => 5
)
)
I want to check if any of $map['x'] and $map['y'] exists in that array so I am doing (Don't know any other way because I need to check this in foreach loop)
if (in_array(array($map['x'], $map['y']), $array)) {
echo 1;
}
But it doesn't work and according to http://php.net/manual/en/function.in-array.php it should work? What am I doing wrong?
$mapDatainstead of$array? (perhaps you just used it as an example)