Given the information you provide the way to go through the values would be through a loop foreach
:
/* $datos = $request->all(); */
$datos = [
'_token' => 'bGJVDLHkRw8jMdsoBvC4ouyBEvgyBs5VLHD8LlDp',
'oculto' => 'Leonela Burgos ',
'id_alumno' => '',
'alumno' => '',
'cedula_alumno_pres' => '',
'dir_alumno_pres' => '',
'telf_alumno_pres' => '',
'fch_nac_alumno_pres' => '',
'sex_alum_pres' => '',
'op_desc_alum' => 'dsc_herm',
'dato_buscar' => '0101030435',
'selector' => '2',
'hermano' => [
39 => '39',
40 => '40',
],
'alumno_fin' => '',
'cedula_alumno' => '',
'edc_alumno' => '',
];
foreach ($datos['hermano'] as $clave => $valor) {
echo '<p>', htmlspecialchars($clave . ' => ' . $valor), '</p>', PHP_EOL;
}
You can not traverse values using count()
because this function calculates the number of elements in a matrix. Your loop would start with 0 and end with 1, preventing you from reaching the keys where the data is stored (39 and 40).
On the other hand, foreach
iterates for each element and allows extracting the index and content of each element.