3v4l.org

run code in 300+ PHP versions simultaneously
<?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'); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: 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.5 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
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.3.32 - 7.3.33
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.5.24 - 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.

preferences:
156.06 ms | 401 KiB | 183 Q