but that just gave a lot of syntax errors. I know that nl2br just gives a line break but I want that to be part of it so that it’s like a list (or if not separated by a comma)
your use of foreach makes no sense here since you try to get a single value out of an array. maybe you can elaborate on the purpose of the $detail array in your code.
// alas, something that makes it valid (as of PHP 5.4)
// in case it is an array
$value = nl2br(end($detail)['detail']);
// otherwise …
// … do whatever should be done it that case
I’m not trying to get a single value but instead the details of every product the user has put in their wishlist. I’d ideally like each product to be separated by a comma and space to make it more legible.
$detail is the quantity of a product, the option (color, size etc) as well as the product name. Is that possible?