Using PHP, I would like to select certain values from an array of objects, join them to form one continuous string separated by commas, and save this to a variable named $isbn
.
I have an array of objects named $items
. A var_dump($items)
produces this. I need to select the item_isbn
value.
My desired result is;
echo $isbn
// would produce
// '0-7515-3831-0,978-0-141-38206-7,978-1-30534-114-1'
Getting rid of the hyphens would be a bonus but I think I can achieve this using str_replace
.