i have array
Array('0284'=>array('name'='XX',
'inputs'=array(
array('sysname'=>'KEY_TO_MATCH1',....);
array('sysname'=>'KEY_TO_MATCH2',....);
),
'0287'=>array('name'='YYY',
'inputs'=array(
array('sysname'=>'KEY_TO_MATCH3',....);
array('sysname'=>'KEY_TO_MATCH4',....);
)
);
what i want is to search $_POST if the key sysname exist then return array 'name'..
example if $_POST['KEY_TO_MATCH1'] exist return XX
EDIT
array structure explanation:
array is result of fetching db table
plugins(id,name,user_id)
plugins_inputs(id,plugin_id(FK),sysname,label,value,extra_attrs)
what i do is to fetch all plugins and its inputs, then i separate them by pluigns_id
Array('plugins.id'=>array('name'='plugins.name',
'inputs'=array(//all rows from plugins_inputs where plugin_id=plugins.id
array('sysname'=>'KEY_TO_MATCH1',....);
array('sysname'=>'KEY_TO_MATCH2',....);
)
plugins.id as key: to avoid duplicates as i cann't trust form.name
plugins.name : points to function name that handles these inputs
plugins_inputs : contain multiple rows of inputs
now i want to listen to $_POST case any of these inputs where submited then redirect it
to that form specific function that handle it. $this->${plugins.name}->backend();
currently using
foreach($array as $id=>$val){
foreach($val['inputs'] as $input)
//$this->input->post is codeigniter help to handle $_POST[] if it doesnt exist it return false
if($this->input->post([$input['sysname']])runbackend($val['name'],$id);
}
but i was wondering if there is smarter way to do it.. using array_filter or array_map or something... }