3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); $b = array(array('id' => 1, 'fid' => 2), array('id' => 2, 'fid' => 2)); $map = array(); foreach($array as $record) { $pointer = &$map; foreach($properties as $property) { $propValue = self::_getPropertyValue($record, $property); $pointer[$propValue][] = $property; $pointer = &$pointer[$propValue]; } } var_dump($map);
based on IGNZk
Output for 5.1.0 - 7.2.0
Notice: Undefined variable: array in /in/f8gtM on line 7 Warning: Invalid argument supplied for foreach() in /in/f8gtM on line 7 array(0) { }
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/f8gtM on line 7 array(0) { }
Output for 4.3.11
array(0) { }