<?php
$cars = Array (
'0' => Array (
'category' => 'Most Selling',
'title' => 'BMW',
'price' => 20000
),
'1' => Array (
'category' => 'Most Selling',
'title' => 'Jeep',
'price' => 15000
),
'2' => Array (
'category' => 'Most Selling',
'title' => 'Lexus',
'price' => 18000
)
);
$data = [
'model' => 'new',
'company' => implode(', ',array_column($cars, 'title'))
];
echo $json = json_encode($data);
preferences:
24.6 ms | 406 KiB | 5 Q