PHP简写跳过变量赋值

I am using this shorthand in a function to set a variable to NULL if it is not set. How can I simply not set it?

function createArray($rows){
 $array = array();

 $array['id'] = isset($rows['UnitId']) ? $rows['UnitId'] : NULL ;

}

Just don't set it in the first place

function createArray($rows){
 $array = array();

 if(isset($rows['UnitId'])) $array['id'] = $rows['UnitId'];

}

Would this be too simple for you?

if(isset($rows['UnitId'])) { 
    $array['id'] = $rows['UnitId'];
}