Can someone help me to fix this code.
this is data array for a CSV file
foreach($feedback as $value) {
$csv_array[] = array(
'title' => $value->title ?: get_the_title($value->post_id),
'feedback_type' => $value->type,
'reason' => $value->reason,
'comments' => $value->comments,
'allow_response' => $value->allow_response === null ? 'No' : 'Yes',
'firstname' => $value->first_name,
'lastname' => $value->last_name,
'phone' => $value->phone,
'email' => $value->email,
'prefered_contact_method' => $value->prefered_contact_method,
'date_submitted' => $value->created_at
);
}
Now I want to know if feedback_type is negative 'reason' => $value->reason
this needs to be empty.
I write this, but looks like something is wrong.
'feedback_type' => $value->type === 'negative' ? 'reason' => $value->reason : ''