Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with empty() and properties #31

Open
koichirose opened this issue Nov 6, 2013 · 1 comment
Open

Issue with empty() and properties #31

koichirose opened this issue Nov 6, 2013 · 1 comment

Comments

@koichirose
Copy link

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?

@wallacesilva
Copy link

i never used Gas, but you can try with strlen() or similar eg.:

if (strlen($deal->start_date) > 0) {

    // your code here  ...

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants