avatar
join array elements into string PHP

Use a join to combine value from Array element into string.

$tags = array_unique($tags, SORT_REGULAR);
$tags = [{"id": 1, "name": "Permission"},{"id": 2, "name": "Android"},{"id": 2, "name": "Kotlin"}]
$str = join(',', array_map(function($item) {
    return $item['name'];
}, $tags));
$str = "Permission, Android, Kotlin"
24
You need to login to do this manipulation!