I have an associative php array in which values are boolean. I'm trying to iterate the array and assign it to variables, however, the extracted values comes out blank
var_dump(info) output is:
array(6)
{
["are_all_daily_budgets_spent"]=> bool(false)
["has_account_hit_spend_limit"]=> bool(false)
["has_campaign_group_hit_spend_limit"]=> bool(false)
["is_adgroup_partially_rejected"]=> bool(false)
["is_account_closed"]=> bool(false)
["is_daily_budget_spent"]=> bool(false)
}
I need to extract the boolean values and assign it to separate variables.
I tried doing the following code:
foreach ($info as $key => $value) {
echo $key;
echo $value;
}
But statement echo $value doesn't produce any results.
Also, can you help me producing the following output:
are_all_daily_budgets_spent = 0
has_account_hit_spend_limit = 0
echo $value ? 'true' : 'false';var_dumpis a better option. If the value is needed somewhere else in your script, you'd be well adviced to not change it to some string representation.trueandfalsewithout it being human-readable, no need to change it.