• Đăng ký
  • Đăng nhập

PHP Fatal error: Uncaught Error: Object of class stdClass could not be converted to string

📅 — 👀 42 — 👦
//$data is indeed an array, but it's made up of objects.
//Convert its content to array before creating it

$data = array();
foreach ($results as $result) {
   $result->filed1 = 'some modification';
   $result->filed2 = 'some modification2';
   $data[] = (array)$result;
}