- array_column: documentation ( source)
- implode: documentation ( source)
<?php
// can't use $this, so replacing with $ths for demonstrative purposes
$ths = (object)[
'item' => (object)[
'tags' => (object)[
'itemTags' => [
(object)['alias' => 'one'],
(object)['alias' => 'two'],
(object)['alias' => 'three'],
]
]
]
];
echo '<div class="realizace_box ' . implode(' ', array_column($ths->item->tags->itemTags, 'alias')) . '">';