[SOLVED] Combine elements to a variable in a json array
Posted: Sun May 15, 2022 2:43 pm
I don't know if the title fits, so let me know if I need to correct it. Here is what I'm trying to modify:
I'm trying to do edit the 'name' like:
But it doesn't work. How do I combine the two elements to a variable in the array.
Thanks.
Code: Select all
foreach ($results as $result) {
$json[] = array(
'id' => $result['product_id'],
'status' => $result['status'],
'image' => $this->model_tool_image->resize(($result['image'] ? $result['image'] : 'no_image.png'), 40, 40),
'name' => strip_tags(html_entity_decode($result['product_id'], ENT_QUOTES, 'UTF-8')));
}
Code: Select all
'name' => strip_tags(html_entity_decode($result['product_id'], ENT_QUOTES, 'UTF-8')))." - ".strip_tags(html_entity_decode($result['sku'], ENT_QUOTES, 'UTF-8')));
Thanks.