3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $one = Array ( 4 => 'bim', 5 => 'pow', 6 => 'foo' ); $two = Array ( 'n' => Array ( 0 => 1 ), 'm' => Array ( 0 => 1, 1 => 2 ), 'l' => Array ( 0 => 1, 1 => 4, 2 => 64 ) ); $result = []; while((list($oneKey, $oneValue) = each($one)) && (list($twoKey, $twoValue) = each($two))) { $temp = []; foreach($twoValue as $item) { $temp[]= $twoKey.'-'.$item; } $result .= $oneValue.' '.join(' ', $temp); }; $result = join(' ', $result); var_dump($result);
Output for 5.4.0 - 7.1.0
Notice: Array to string conversion in /in/ptW9W on line 38 Warning: join(): Invalid arguments passed in /in/ptW9W on line 40 NULL
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ptW9W on line 29
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/ptW9W on line 29
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ptW9W on line 29
Process exited with code 255.