PHP array to string conversion -
i'm trying access php array. throwing me array string conversion error.
this code
if(isset($_post['category'])){ $category = array($_post['category']); if(sizeof($category) > 0){ foreach($category $key){ $categ = $categ.$key.', '; } } }
do this..
if (isset($_post['category'])) { if (!is_array($_post['category'])) { $category = array($_post['category']); } else { $category = $_post['category']; } $categ = ''; foreach ($category $value) { if (!is_string($value)) { // anything, not autocast string! continue; } $categ .= $value . ', '; } }
Comments
Post a Comment