Convert array objects to string and separate the values Convert array objects to string and separate the values codeigniter codeigniter

Convert array objects to string and separate the values


You are missing the fact that you are dealing with an array of objects.

Looks like you can achieve that by doing:

$output = array_map(function ($object) { return $object->name; }, $input);echo implode(', ', $output);


To use this feature in the 'title' attribute I did:

echo implode('
', $output);


It will convert the array of objects to a string, and you can store it in the database, use

serialize(array_of_object)

Might help someone. I used it in my case. Thank you!