I'm trying to filter values that will be inside array. For that I used following syntax: $selected = array(
if ($request->annual!=0) {
'annual' => $request->annual,
}
if ($request->registration!=0) {
'registration' => $request->registration,
}
if ($request->monthly!=0) {
'monthly' => $request->registration,
}
if ($request->exam!=0) {
'exam' => $request->exam,
}
if ($request->laboratory!=0) {
'laboratory' => $request->laboratory,
}
if ($request->computer_lab!=0) {
'computer_lab' => $request->computer_lab,
}
);
But it is throwing syntax error.
syntax error, unexpected 'if' (T_IF), expecting ')'
What is the problem here? Can anyone help me?
Aucun commentaire:
Enregistrer un commentaire