if (!empty($aErrorMessages)){ print('The following errors occurred: '); foreach ($aErrorMessages AS $error) { print PHP_EOL . $error; }}else{ // all good.}