I have a simple statement like this:
$data['title'] = isset($domain['title']) ? $domain['title'] : '';
This is ok. The data array is then used in an insert query using codeigniter active record. Now I wanted to ask is there a way that if isset returns false, then don’t initialize $data[‘title’].
I know the alternative here
if(isset($domain['title'])){
$data['title'] = $domain['title'];
}
I want to know how can we do the same if with the upper instruction?
You could do this, but use
ifis more readable.Edit:
Example of using a loop.