0
My function is this and takes a number that the user type and sees if it corresponds to a position of the matrix, if true, would display the information of the internal array, but the information is not displayed correctly:
function localizar($id){
echo "<h2>Resultado para o id $id:</h2>";
for($i = 0; $i < count($_SESSION['array2']); $i++){
if($_SESSION['array2'][$i] = $id){
for($s = 0; $s < count($_SESSION['array1'][$i]); $s++){
$result = $_SESSION['array1'][$id][$i];
break;
}
echo $result;
}else{
echo "Não encontramos correspondências";
}
echo "<br>";
}
Matrix:
function cadastrar($nome, $raca, $cor, $tipoPelo){
$_SESSION['array1'][] = array($nome, $raca, $cor, $tipoPelo);
$_SESSION['array2'][] = $_SESSION['array1'];
}
How information is displayed:
Puss 1 Race 1
How they should be displayed:
Puss 1 Race 1 Colour 1 Type 1