I have the following code
while($row = $usafisRSP->fetch_assoc())
{
$hidden_keys = array('Applicantid', 'unique_num', 'regs_time' ....);
$hidden_fields = array_intersect_key($row, array_fill_keys($hidden_keys, NULL));
$hidden_values = array();
foreach ($hidden_fields as $key => $value) {
// fill the values array using the values from fields array
$hidden_values[$value] = "$key = ".base64_decode($value)."
";
if(base64_decode($value)== 0)
{
$hidden_values[$value] = "";
}
echo $hidden_values[$value];
The question is about “if($hidden_values[$value] == 0)” … Basically I want to do not display/echo the $hidden_values[$value] if it’s value of $value is 0. Sometimes $value is 0 or some words like (23 avenue).
I think you ran into three catches with PHP type comparisons and equalities:
if(base64_decode($value)== 0)will likely always resolve to true, even if decoded$valueis"Adam".if(base64_decode($value) === 0)wouldn’t even work if decoded$valueis"0". Another catch is base64_decode may return false on errors, again failing this strict equality check."0") will always loosely equal true. So this is the only comparison you really need for your case.I think this is what you want, replacing the last 5 lines…