I have the following array -
Array
(
[31] => Array
(
[0] => 3
[1] => 3
)
[33] => Array
(
[0] => 2
[1] => 1
)
)
Now for the key 31 both of the elements has same value ie 3 but not for the key 33. So I am trying to create another array which will look like.
Array
(
[31] => same
[33] => notsame
)
That means if a key from multidimensional array has got all the values same then it will have the text 'same' else 'notsame'
My code-
foreach($subvaluesArr as $k1=>$v1) //$subvaluesArr is the multidimensional array here
{
foreach($v1 as $k2=>$v2)
{
if($v1[$k2] = $v1[$k2+1])
{
$newArr[$k1] = 'same';
}
else
{
$newArr[$k1] = 'notsame';
}
}
}
echo '<pre>';
print_r($newArr);
echo '</pre>';
And the output is showing 'notsame' for both keys.
Array
(
[31] => notsame
[33] => notsame
)
Any help is highly appreciated.
===inifstatement.