php - Invalid argument supplied for foreach() : Yii2
one text
Solution:
Since $plusone_subjects
is not valid json, you can manually change it to valid json and then convert it to an array like so:
$plusone_subjects = "[$plusone_subjects]"; //covert string to valid json;
$plusone_subjects = json_decode($plusone_subjects,true); //covert to array
foreach ($plusone_subjects as $subject)
{
echo $subject["subject_name"];
}
Source