0
Next, I have a value saved array in the variable $chaves
as the example below:
array(2) {
[0] => array(1) {
["chave"] => string(1) "1"
}
[1] => array(1) {
["chave"] => string(1) "3"
}
}
I made a bow:
foreach ($chaves as $chave) {
if (in_array($row['chave'], $chave)) {
echo 'ok, é igual';
} else {
echo 'ok, não é igual';
}
}
However, it is printing like "ok, it’s equal ok, it’s not equal", but it should print: "ok, it’s not equal" when the value is different and "ok, it’s equal" when the value is equal.
The idea is to show that it is the same when the key values are equal.
I’m running out of time to respond, but to help in case no one shows up, search by Flatten array.
– Gabriel Katakura
Gives a
return;
after printing it will stop at the first exit;– Ivan Ferrer
@Ivanferrer Can’t Give Re-turn; because if I give it it doesn’t continue to list the other records who comes from $Row...
– HananiaMizrahi