First I have this array
$age = $request->age //laravel's input
$m_array = array(
'jason' => array(
'age' => '21',
'gender' => 'male'
),
'mechelle' => array(
'age' => '19',
'gender' => 'female'
),
'Khent' => array(
'age' => '25',
'gender' => 'male'
)
);
and then check if a specified array exist from the $m_array arrays
if(isset($m_array['jason'])):
endif
and then I want to check if each array that has a 'jason' value and its sub array named 'age' has the same value from the variable '$age' and if does not then add the same array but not the same sub array named 'age' value e.g.
$m_array['jason'] = array('age' => $age, 'gender' => 'male')
so the expected output if an array is added with the same name but not the same sub array named 'age' value will be
$m_array = array(
'jason' => array(
'age' => '21',
'gender' => male
),
'jason' => array(
'age' => '18',
'gender' => male
)
);
any ideas, help, clues, recommendations, suggestions to achieve that please?