if (faillengthtest($foo)) { if (failrepeattest($foo)) { #format the page with error msg 1 } else { #format the page with error msg 2 } } else { if (failrepeattest($foo)) { #format the page with error msg 3 } else { #format the page with normal message } }