[eluser]jtotheb[/eluser]
I have a 2 dimensional array that i need to check for a value (the value is in a normal array and i want to do something like
and if that value is present then add another value to the array.
The below is the code i have:
Code:
$multi = Array(array(
'BAND' => '1',
'VALUE' => 'Test',
'parent' => '99999999'
),
array(
'BAND' => '2',
'VALUE' => 'Test2',
'parent' => '99999999'
),
array(
'BAND' => '3',
'VALUE' => 'Test3',
'parent' => '99999999'
),
array(
'BAND' => '4',
'VALUE' => 'Test3',
'parent' => '99999999'
)
);
$numbers = array(
'1',
'2',
'3'
);
And i want to say something like: if in_array($value, $numbers) add array item so that the array above now looks like this:
Code:
$multi = Array(array(
'BAND' => '1',
'VALUE' => 'Test',
'parent' => '99999999',
'new_value' => '1'
),
array(
'BAND' => '2',
'VALUE' => 'Test2',
'parent' => '99999999',
'new_value' => '1'
),
array(
'BAND' => '3',
'VALUE' => 'Test3',
'parent' => '99999999',
'new_value' => '1'
),
array(
'BAND' => '4',
'VALUE' => 'Test3',
'parent' => '99999999',
)
);
I hope this makes sense to someone and i hope someone can help!!
Cheers!!