<?php if(empty($username)) {array_push($errors, "Username is required")}; ?>

i put this line inside a php file but there is a problem with it, can someone explain what I'm doing wrong?

  • 1
    Try this <?php if(empty($username)) {array_push($errors, "Username is required");} ?> – Pratik Patel Mar 12 '19 at 5:26

You have misplaced ; in your code, it should be

<?php if( empty( $username ) ) { array_push( $errors, "Username is required" ); } ?>

Not the answer you're looking for? Browse other questions tagged or ask your own question.