3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $menuitems = array(array('name'=>'First menu item', 'link'=>'http://firstitem.com','class'=>'normal'), array('name'=>'Second menu item', 'link'=>'http://second.com','class'=>'normal'), array('name'=>'Third menu item', 'link'=>'http://third.com','class'=>'normal') ); function printMenu($menutiem) { echo "<a href='{$menuitem['link']}' class='{$menuitem['class']}'>{$menuitem['name']}</a>"; } function genmenu($a_menuitems) { foreach ($menuitems as $menuitem) { printMenu($menuitem); } } genmenu($menuitems);
based on B7Okk
Output for 5.1.0 - 7.2.0
Notice: Undefined variable: menuitems in /in/SW00D on line 13 Warning: Invalid argument supplied for foreach() in /in/SW00D on line 13
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/SW00D on line 13
Output for 4.3.11