3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = <<<EOD [a-1]****************** [b-2]********** [c-3]*** EOD; preg_match_all('/^\[[^\]]*+](.*?)$/m' , $text, $matches, PREG_SET_ORDER); $result = array(); foreach ($matches as $match) { $result[$match[1]] = $match[2]; } var_dump($result);
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 2 in /in/CfJPY on line 11 Notice: Undefined offset: 2 in /in/CfJPY on line 11 Notice: Undefined offset: 2 in /in/CfJPY on line 11 array(3) { ["******************"]=> NULL ["**********"]=> NULL ["***"]=> NULL }
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: 2 in /in/CfJPY on line 11 Notice: Undefined index: 2 in /in/CfJPY on line 11 Notice: Undefined index: 2 in /in/CfJPY on line 11 array(3) { ["******************"]=> NULL ["**********"]=> NULL ["***"]=> NULL }
Output for 4.3.0 - 4.4.1, 4.4.3 - 5.1.1, 5.1.3 - 5.2.17
Notice: Undefined offset: 2 in /in/CfJPY on line 11 Notice: Undefined offset: 2 in /in/CfJPY on line 11 Notice: Undefined offset: 2 in /in/CfJPY on line 11 array(3) { ["******************"]=> NULL ["**********"]=> NULL ["***"]=> NULL }
Output for 4.4.2, 5.1.2
Notice: Undefined offset: 2 in /in/CfJPY on line 12 Notice: Undefined offset: 2 in /in/CfJPY on line 12 Notice: Undefined offset: 2 in /in/CfJPY on line 12 array(3) { ["******************"]=> NULL ["**********"]=> NULL ["***"]=> NULL }