3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = <<<STRING 34 Item 5423 11Item 44 Item 3470 BLABLA TEF2200 STRING; $arr = array(); foreach (explode("\n", $data) as $row) { preg_match('/^(?<id>\d+)\s+(?<name>[\w ]+)$/', $row, $matches); $id = $matches['id']; $name = $matches['name']; if ($id > 1 && $id < 65366) { $arr[$id] = $name; } } print_r($arr);
Output for 4.4.6 - 4.4.9, 5.2.2 - 7.1.0
Array ( [34] => Item [5423] => 11Item [44] => Item [3470] => BLABLA TEF2200 )
Output for 5.2.0 - 5.2.1
Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Array ( )
Output for 4.3.11 - 4.4.1, 4.4.3 - 4.4.5, 5.0.0 - 5.1.1, 5.1.3 - 5.1.6
Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Array ( )
Output for 4.4.2, 5.1.2
Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 13 Notice: Undefined index: id in /in/hunbN on line 15 Notice: Undefined index: name in /in/hunbN on line 16 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 13 Notice: Undefined index: id in /in/hunbN on line 15 Notice: Undefined index: name in /in/hunbN on line 16 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 13 Notice: Undefined index: id in /in/hunbN on line 15 Notice: Undefined index: name in /in/hunbN on line 16 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 13 Notice: Undefined index: id in /in/hunbN on line 15 Notice: Undefined index: name in /in/hunbN on line 16 Array ( )
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Warning: Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Warning: Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Warning: Compilation failed: unrecognized character after (?< at offset 4 in /in/hunbN on line 12 Notice: Undefined index: id in /in/hunbN on line 14 Notice: Undefined index: name in /in/hunbN on line 15 Array ( )