Here is the code:
<? $fields = json_decode($this->item->extra_fields);
$allowed_fields= array('3','5');
if ( $fields != NULL ) {
foreach ( $fields as $field ) {
if ( in_array($field->id, $allowed_fields ) && $field->value != NULL) {
?>
<span class = "list_for<? echo $field->id; ?>">
<? echo $field->value;?></span><? } } }?>
When I change json_decode to json_encode I get the following error:
Warning: Invalid argument supplied for foreach()...
----------
Everything worked before the upgrade of PHP to 5.4 from 5.3.
I am not a developer so please try to not be too technical. Thanks in advance!
$fieldsis not an array.