3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_POST['email'] = 'test@mail.com'; $_POST['emailrepeat'] = 'test@gmail.com'; function cleanInput($input){ if(isset($_POST[$input])){ $input = $_POST[$input]; }else{ return false; } $input = htmlspecialchars($input); $input = trim($input); $input = stripslashes($input); return $input; } function isCorrectLength($input,$min,$max){ $x = mb_strlen($input); return ($x >= $min && $x <= $max); } if($email = cleanInput('email')){ if(filter_var($email, FILTER_VALIDATE_EMAIL)){ if(isCorrectLength($email,1,60)){ if(!$auth->isEmailTaken($email)){ $email_clean = $email; }else{ array_push($errorMessages,'Your email is already registered'); } }else{ array_push($errorMessage,'Your email is too long'); } }else{ array_push($errorMessages,'You entered an incorrect email'); } }else{ array_push($errorMessages,'You did not input an email'); } if($emailrepeat = cleanInput('emailrepeat')){ if(strcasecmp($email_clean, emailrepeat) != 0){ echo "$emailrepeat<br>$email_clean<br>"; array_push($errorMessages,'Your emails did not match'); } }else{ array_push($errorMessages,'You did not repeat your email'); }
based on QQCiC
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: auth in /in/Hv9hN on line 26 Fatal error: Uncaught Error: Call to a member function isEmailTaken() on null in /in/Hv9hN:26 Stack trace: #0 {main} thrown in /in/Hv9hN on line 26
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: auth in /in/Hv9hN on line 26 Fatal error: Uncaught Error: Call to a member function isEmailTaken() on unknown in /in/Hv9hN:26 Stack trace: #0 {main} thrown in /in/Hv9hN on line 26
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: auth in /in/Hv9hN on line 26 Fatal error: Call to a member function isEmailTaken() on null in /in/Hv9hN on line 26
Process exited with code 255.
Output for 5.3.21 - 5.5.35
Notice: Undefined variable: auth in /in/Hv9hN on line 26 Fatal error: Call to a member function isEmailTaken() on a non-object in /in/Hv9hN on line 26
Process exited with code 255.