<?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?

closed as off-topic by Krzysiek Dróżdż, fuxia Mar 12 at 14:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Try this <?php if(empty($username)) {array_push($errors, "Username is required");} ?> – Pratik Patel Mar 12 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.