3v4l.org

run code in 300+ PHP versions simultaneously
<?php function splitEmail($str) { $pattern = "/([\w\s\'\"]+[\s]+)?(<)?(([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4}))?(>)?/"; preg_match($pattern, $str, $match); return array( 'name' => isset($match[1]) ? trim($match[1]) : null, 'email' => isset($match[3]) ? trim($match[3]) : null, ); } $e = array( '<foo@bar.com>', 'Miguel <miguel@bar.com>', '"ddd" <123@d.com>', 'll\'f <ddd@ddd.ll>', 'foo@bar.com', ); foreach($e as $v) { var_dump(splitEmail($v)); }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: preg_match(): Compilation failed: invalid range in character class at offset 27 in /in/m9kC8 on line 6 array(2) { ["name"]=> NULL ["email"]=> NULL } Warning: preg_match(): Compilation failed: invalid range in character class at offset 27 in /in/m9kC8 on line 6 array(2) { ["name"]=> NULL ["email"]=> NULL } Warning: preg_match(): Compilation failed: invalid range in character class at offset 27 in /in/m9kC8 on line 6 array(2) { ["name"]=> NULL ["email"]=> NULL } Warning: preg_match(): Compilation failed: invalid range in character class at offset 27 in /in/m9kC8 on line 6 array(2) { ["name"]=> NULL ["email"]=> NULL } Warning: preg_match(): Compilation failed: invalid range in character class at offset 27 in /in/m9kC8 on line 6 array(2) { ["name"]=> NULL ["email"]=> NULL }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.61 ms | 402 KiB | 8 Q