I want to convert all null with empty string I have used array_walk_recursive but I haven't got what I want please help me to figure it out what I have done wrong here.
protected function setData($key, $value)
{
$this->data[$key] = $value;
array_walk_recursive($this->data, function (&$item, $key) {
$item = null === $item ? '' : $item;
});
return $this->data;
}
$item = !is_null($item) ? $item : '';