Entering edit mode
6.7 years ago
nemo
▴
40
I am looking for a function that could directly determine if the value is missing or not. I could use this code:
$data = array();
if (empty($row['AccessionNumber'])) {
$data[] = 'NA';
#echo "NA";
}
else {
$data[] = $row['AccessionNumber'];
#echo $row['AccessionNumber'];
}
but it is too extensive. Because I want to use the code on multiple row and in different parts of my script. I think it would be easier if I just could use a function that does it instantly. I try to use this code:
isset($row['AccesionNumber'])?$row['AccesionNumber']:'NA'
But it always return NA and not the value if there is one.
Why don't you define the function?