Disable top-level menus from Admin Panel 2

This snippet disables top-level menus, like Comments, from the main menu in the Admin Panel.

Code Snippet:

<?php
function remove_menu_items() {
global $menu;
  $restricted = array(__('Links'), __('Comments'));
  end ($menu);
  while (prev($menu)){
  $value = explode(' ',$menu&#91;key($menu)&#93;&#91;0&#93;);
  if(in_array($value&#91;0&#93; != NULL?$value&#91;0&#93;:"" , $restricted)){unset($menu&#91;key($menu)&#93;);}
	}
}
add_action('admin_menu', 'remove_menu_items');
?>

Posted in Admin area