The string '0'
is not truthy. That means that anything that checks it in a boolean'ish manner will treat it as false. In particular, empty($_POST['away_score'])
will evaluate to true
, so is_numeric
would never even get a chance to fail.
Short version: empty
is too wishy-washy in this case. Check for null and ''
explicitly.
if (!isset($_POST['away_score']) or $_POST['away_score'] == '') {