<?php // your code goes here function stop_at($array) { $out = ‘’; foreach($array as $item) { if ($item == 42) { break; } $out .= $item."\n"; } return $out; } echo stop_at($arr);
1 2 3 55 24 42 33
‘’
PHP Notice: Undefined variable: arr in /home/58kt2Z/prog.php on line 16 PHP Notice: Use of undefined constant ‘’ - assumed '‘’' in /home/58kt2Z/prog.php on line 5 PHP Warning: Invalid argument supplied for foreach() in /home/58kt2Z/prog.php on line 7