<?php
function getKeyFromName($array, $name) {
foreach($array as $key => $value) {
if ($value["nome"] == $name) {
return $key;
}
}
return false;
}
$data = [
[
"nome" => "ACRILEX TECIDO 37ML AMARELO CANARIO",
"preco" => "1.65",
"quantidade" => "1",
"imagem" => "Loja/imgPQ/4140589589.gif"
],[
"nome" => "ACRILEX TECIDO 37ML AMARELO LIMÃO",
"preco" => "1.65",
"quantidade" => "1",
"imagem" => "Loja/imgPQ/4140504504.gif"
]
];
echo getKeyFromName($data, "ACRILEX TECIDO 37ML AMARELO LIMÃO");
PD9waHAKCmZ1bmN0aW9uIGdldEtleUZyb21OYW1lKCRhcnJheSwgJG5hbWUpIHsKICAgIGZvcmVhY2goJGFycmF5IGFzICRrZXkgPT4gJHZhbHVlKSB7CiAgICAgICAgaWYgKCR2YWx1ZVsibm9tZSJdID09ICRuYW1lKSB7CiAgICAgICAgICAgIHJldHVybiAka2V5OwogICAgICAgIH0KICAgIH0KCiAgICByZXR1cm4gZmFsc2U7Cn0KCiRkYXRhID0gWwoJWwoJCSJub21lIiA9PiAiQUNSSUxFWCBURUNJRE8gMzdNTCBBTUFSRUxPIENBTkFSSU8iLAogICAgICAgICJwcmVjbyIgPT4gIjEuNjUiLAogICAgICAgICJxdWFudGlkYWRlIiA9PiAiMSIsCiAgICAgICAgImltYWdlbSIgPT4gIkxvamEvaW1nUFEvNDE0MDU4OTU4OS5naWYiCiAgICBdLFsKCiAgICAgICAgIm5vbWUiID0+ICJBQ1JJTEVYIFRFQ0lETyAzN01MIEFNQVJFTE8gTElNw4NPIiwKICAgICAgICAicHJlY28iID0+ICIxLjY1IiwKICAgICAgICAicXVhbnRpZGFkZSIgPT4gIjEiLAogICAgICAgICJpbWFnZW0iID0+ICJMb2phL2ltZ1BRLzQxNDA1MDQ1MDQuZ2lmIgogICAgXQpdOwoKZWNobyBnZXRLZXlGcm9tTmFtZSgkZGF0YSwgIkFDUklMRVggVEVDSURPIDM3TUwgQU1BUkVMTyBMSU3Dg08iKTs=