Skip to content
Advertisement

Tag: zero

PHP if statement: Zero vs ’empty’

I’m creating a WordPress website using the Advanced Custom Fields plugin. I have a set of fields for tennis score results. In the template, I’m showing these fields like this: The problem is that some scores are zero, so they’re not showing up. I understand that this is because 0 basically equals null, so the statement is false. One solution

Advertisement