in the example given, "failed" is just a string used to pass validation. the string can be replaced with anything. it could be replaced with "passed", "123" or even "donald duck".
<?php echo((isset($_POST['firstField']) && isset($_POST['lastField']) && strtoupper($_POST['lastField']) == strtoupper($_POST['firstField']))?"123":""); ?>