I am getting the value from my JSON like so:
$adarray = json_decode($addata);
if($adarray->{'zone'} == 'homepage'){
$chan = 'homepage';
}else if($adarray->{'subcat'} == 'main'){
$chan = $adarray->{'cat'};
}else{
$chan = $adarray->{'subcat'};
}
echo $chan;
It the else if and else it works perfectly however, I am having trouble with the first part:
When this JSON data is parsed into the if statement it should return ‘homepage’ yet it just returns the JSON data back, why?
{"zone":"homepage"}
Tried the same code on php tester, and got the correct output. Once see if your code is correct.
Try this yourself on http://phptester.net/ :