3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); $emails = [ "bob@example.com", "test@example.local", "invalidemail" ]; var_dump(filter_var($emails, FILTER_VALIDATE_EMAIL, FILTER_REQUIRE_ARRAY)); var_dump(filter_var($emails, FILTER_VALIDATE_EMAIL, '16777216'));
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array(3) { [0]=> string(15) "bob@example.com" [1]=> string(18) "test@example.local" [2]=> bool(false) } Fatal error: Uncaught TypeError: filter_var(): Argument #3 ($options) must be of type array|int, string given in /in/fn513:13 Stack trace: #0 /in/fn513(13): filter_var(Array, 274, '16777216') #1 {main} thrown in /in/fn513 on line 13
Process exited with code 255.

preferences:
76.82 ms | 1154 KiB | 4 Q