3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //FILTER_VAR email VALIDATION TEST: thanks http://us3.php.net/filter_var#112492 $valid_rfc_emails = array( 'localpart.ending.with.dot.@example.com', '(comment)localpart@example.com', '"this is v@lid!"@example.com', '"much.more unusual"@example.com', 'postbox@com', 'admin@mailserver1', '"()<>[]:,;@\\"\\\\!#$%&\'*+-/=?^_`{}| ~.a"@example.org', '" "@example.org', ); $valid = array(); $invalid = array(); foreach ($valid_rfc_emails as $address) { if (filter_var($address, FILTER_VALIDATE_EMAIL)){ $valid[] = $address; }else{ $invalid[] = $address; } } echo 'valid: '; print_r($valid); echo 'invalid (but really valid by rfc): '; print_r($invalid); ?>
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
valid: Array ( ) invalid (but really valid by rfc): Array ( [0] => localpart.ending.with.dot.@example.com [1] => (comment)localpart@example.com [2] => "this is v@lid!"@example.com [3] => "much.more unusual"@example.com [4] => postbox@com [5] => admin@mailserver1 [6] => "()<>[]:,;@\"\\!#$%&'*+-/=?^_`{}| ~.a"@example.org [7] => " "@example.org )
Output for 5.2.11 - 5.2.13, 5.3.1 - 5.3.2
valid: Array ( [0] => localpart.ending.with.dot.@example.com [1] => "this is v@lid!"@example.com [2] => "much.more unusual"@example.com [3] => postbox@com [4] => " "@example.org ) invalid (but really valid by rfc): Array ( [0] => (comment)localpart@example.com [1] => admin@mailserver1 [2] => "()<>[]:,;@\"\\!#$%&'*+-/=?^_`{}| ~.a"@example.org )
Output for 5.2.9 - 5.2.10, 5.3.0
valid: Array ( [0] => localpart.ending.with.dot.@example.com [1] => "this is v@lid!"@example.com [2] => "much.more unusual"@example.com [3] => postbox@com [4] => admin@mailserver1 [5] => " "@example.org ) invalid (but really valid by rfc): Array ( [0] => (comment)localpart@example.com [1] => "()<>[]:,;@\"\\!#$%&'*+-/=?^_`{}| ~.a"@example.org )
Output for 5.2.1 - 5.2.8
valid: Array ( [0] => "this is v@lid!"@example.com [1] => "much.more unusual"@example.com [2] => " "@example.org ) invalid (but really valid by rfc): Array ( [0] => localpart.ending.with.dot.@example.com [1] => (comment)localpart@example.com [2] => postbox@com [3] => admin@mailserver1 [4] => "()<>[]:,;@\"\\!#$%&'*+-/=?^_`{}| ~.a"@example.org )
Output for 5.2.0
valid: Array ( [0] => "much.more unusual"@example.com [1] => " "@example.org ) invalid (but really valid by rfc): Array ( [0] => localpart.ending.with.dot.@example.com [1] => (comment)localpart@example.com [2] => "this is v@lid!"@example.com [3] => postbox@com [4] => admin@mailserver1 [5] => "()<>[]:,;@\"\\!#$%&'*+-/=?^_`{}| ~.a"@example.org )
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function filter_var() in /in/Pg5LW on line 16
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: filter_var() in /in/Pg5LW on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: filter_var() in /in/Pg5LW on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: filter_var() in /in/Pg5LW on line 16