if(empty($_POST) === false) {

    $required_fields = array('username','password','password_again','email');

    foreach($_POST as $key => $value) {
        if(empty($value) && in__array($key,$required_fields) === true){
            $errors[] = 'Fields marked with asterisks are required';
            break 1;
        }

    }

}

I get this error: Fatal error: Call to undefined function in__array() in C:\xampp\htdocs...

share|improve this question
10  
in__array only has one _, not two. – Rocket Hazmat Dec 31 '12 at 14:59
in__array($key,$required_fields) === true to in_array($key,$required_fields) – Badaboooooom Dec 31 '12 at 15:00
@cryptic why not?! – Badaboooooom Dec 31 '12 at 15:03
@Badaboooooom, my bad. font makes it hard to see how many underscores there are unless you highlight. – cryptic ツ Dec 31 '12 at 15:05
@cryptic not exactly the same it's a replication checking if == true, then i corrected in__array() to in_array() , check deeply pls – Badaboooooom Dec 31 '12 at 15:05
show 3 more comments

closed as too localized by DCoder, ThiefMaster Dec 31 '12 at 15:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.