I'm attempting to concatenate two values from a serialized array. I have this working well. The problem is one of the values Size
in this case, contains white-space. I need to remove this whitespace. I have used preg_match
before to remove the white-space from a variable/string. The problem I have here is how I might implement preg_match
in this instance, if it is the correct approach.
foreach($contents as $item)
{
$save = array();
$item = unserialize($item);
**$item['sku'] = $item['sku'] . '' . $item['options']['Size'];**
//echo '<pre>';
//print_r($item['sku']);
//exit();
$save['contents'] = serialize($item);
$save['product_id'] = $item['id'];
$save['quantity'] = $item['quantity'];
$save['order_id'] = $id;
$this->db->insert('order_items', $save);
}
Many thanks.