I have an array which will have 3 cases like this:
First:
array: [
"QtyIn" => "0"
"QtyOut" => "0"
]
Second:
array: [
"QtyIn" => "0"
]
Third:
array: [
"QtyOut" => "0"
]
Now I want to check if QtyIn = 0, return A. QtyOut = 0, return B. And if QtyIn and QtyOut = 0, return C. I tried with 3 if statements like this:
if ( isset($data['QtyIn']) && isset($data['QtyOut']) ) {
if ( $data['QtyIn'] <= 0 && $data['QtyOut'] <= 0 ) {
return A
}
}
if ( isset($data['QtyIn']) ) {
if ( $data['QtyIn'] <= 0 ) {
return B
}
}
if ( isset($data['QtyOut']) ) {
if ( $data['QtyOut'] <= 0 ) {
return C
}
}
Is there anyway to write this code more clean?
Thank you!