3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( 'dates' => array('2013-04-22','2013-04-23'), 'publisherName' => array('Comp1', 'Comp2'), 'loaded' => array(2189, 37), 'clicks' => array(0, 0), 'ctr' => array(0, 0) ); $dates = array_shift($array); $output = array(); foreach ($array as $k => $a) { foreach ($a as $i => $v) { $output[$i][$k] = $v; } } $example = array_combine($dates, $output); var_dump($example);
Output for 5.0.0 - 7.1.0
array(2) { ["2013-04-22"]=> array(4) { ["publisherName"]=> string(5) "Comp1" ["loaded"]=> int(2189) ["clicks"]=> int(0) ["ctr"]=> int(0) } ["2013-04-23"]=> array(4) { ["publisherName"]=> string(5) "Comp2" ["loaded"]=> int(37) ["clicks"]=> int(0) ["ctr"]=> int(0) } }
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_combine() in /in/qNnVb on line 18
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_combine() in /in/qNnVb on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_combine() in /in/qNnVb on line 18