I have this object:
$boosts = array(
"2x12" => 500,
"2x24" => 800,
"2x7d" => 4500,
"3x12" => 700,
"3x24" => 1300,
"3x7d" => 6500
);
And then a variable: $type = "2x12";
What I want to do is check in a loop if the variable $type exists in $boosts. I tried a lot of codes but I couldn't get it.
foreach ($boosts as $savedTypes) {
echo json_encode($savedTypes) . "|";
if ($boosts[$type] === $type) {
echo "VALID";
}
}
array_key_exists( $key, $arr )?