I have the following array:
array (size=80)
0 =>
array (size=2)
‘cod_produto' => int 107
'valor' => float 20
1 =>
array (size=2)
‘cod_produto' => int 109
'valor' => float 375.8
2 =>
array (size=2)
‘cod_produto' => int 112
'valor' => float 20
I'm putting it like this:
Loop {
// Monta array
$valores[] = array(
"cod_produto" => (int) $resultado_precos-> cod_produto,
"valor" => (float) $resultado_precos->valor
);
}
The array is in a variable $valores
, I need to indent the value of the product in a report, but I only have cod_produto
.
I need to search the array for the value of the product and if the value does not exist I have to display the value as zero.
In short, I have the product code and need to find the price of it in this array.