Getting the names is as simple as the following:
$titles = implode(', ', array_column($g, 'title'));
Assuming a dummy cart like this (I included a cyrillic value since you mentioned that in your follow up question):
$g = [
['title' => 'This is a title', 'something' => 'else'],
['title' => 'Some things', 'something' => 'else'],
['title' => 'Word', 'something' => 'else'],
['title' => 'Владимир', 'something' => 'else'],
];
the result will be a string:
This is a title, Some things, Word, Владимир
How it works
First we extract just the titles; array_column($g, 'title')
will produce an array like this:
array(
0 => 'This is a title',
1 => 'Some things',
2 => 'Word',
3 => 'Владимир',
)
After that, all that is left is to implode
all those array elements into a single string. I used a comma as the glue delimiter, but you could use whatever you need.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…