gas-orm
gas-orm copied to clipboard
Issue with empty() and properties
I'm having trouble determining if an object has a property:
if (!empty($deal->start_date)) {
echo $deal->start_date; //outputs nothing, does not enter the if
}
$start_date = $deal->start_date;
if (!empty($start_date)) {
echo $deal->start_date; //outputs the deal start date, enters the if
}
What is going on?
i never used Gas, but you can try with strlen()
or similar eg.:
if (strlen($deal->start_date) > 0) {
// your code here ...
}