Someone around here must have done this before. I want to look for a value within an arrangement, well my structure is something I have two associative arrangements and I want to search in one of them, so that my code is better understood here.
$personsgroup = array();
$areagroup = array();
//Primer arreglo con datos que es en el que voy a buscar
$personsgroup[] = array('correo' => $this->request->data('correo'),
'password' => $this->_passwordGenerate(),
'nombres' => $this->request->data('nombres'),
'apellidos_paternos' => $this->request->data('ape_paterno'),
'apellidos_maternos' => $this->request->data('ape_materno'),
'empresa' => $this->request->data('empresa'),
'nivel' => $this->request->data('nivel'),
'area' => $this->request->data('area'));
//Aqui el segundo arreglo se llena de datos
for($i = 0; $i <= $quantitylevel;$i++){
$level = $this->RptNiveles->newEntity();
$level->id_nivel = $id_nivel;
$level->id_rpt_empresa = $group->id_rpt_empresa;
$level->nombre = $areagroup[0]["area"][$i];
$this->RptNiveles->save($level);
$id_nivel++;
//Dentro de esta linea
$personsgroupreport[] = array(
'id_nivel' => $level->id_nivel,
'nombre_nivel' => $level->nombre
);
}
//Aqui recorro el primer arreglo y que es donde debo realizar la búsqueda con la información que hay dentro del segundo arreglo
for($p=0;$p <= $groupersons;$p++){
$persons = $this->Personas->newEntity();
$persons->id_persona = $id_persons;
$persons->id_usuario = $id_usuario;
$persons->id_admin = $id_usuario;
$persons->usuario = $personsgroup[0]["correo"][$p];
$persons->password = $personsgroup[0]["password"][$p];
$persons->nombre = $personsgroup[0]["nombres"][$p];
$persons->ape_paterno = $personsgroup[0]["apellidos_paternos"][$p];
$persons->ape_materno = $personsgroup[0]["apellidos_maternos"][$p];
$persons->nombre_completo = $personsgroup[0]["apellidos_paternos"][$p].' '.$personsgroup[0]["apellidos_maternos"][$p].', '.$personsgroup[0]["nombres"][$p];
$persons->emp_nombre = $personsgroup[0]["empresa"][$p];
$this->Personas->save($persons);
$this->Evaluaciones->InsertEvaluation($persons->id_persona,$id_usuario);
$id_persons++;
}
Well I searched and php has this function Array-search , the topic is in that this function returns an integer and what I want are the values of the array ie "Password" = > "Value"