is there a way to pass a parameter to a add_menu_page function?

What i ended up doing is setting the page array as a class variable then doing the normal add add_menu_page or add_submenu_page.. while the callback function is the same function.

in callback function i take the $_GET[‘page’] and then look in the array i put inside the class’s variable..

consider that page’s name are: 0.manage_options.pagename.php

like so:

$classLib = glob(SERVICES.'/*.php');
$pagesArray = array();
$mainMenu = '';
 foreach($classLib as $className) {
    $tempPages = explode('.',str_replace('.php', '', basename($className)));
    $menu_title = $this->wp_utils->get_admin_menu_clear_name($tempPages['2']);

    $pagesArrayTemp[$tempPages[0]] = array(
        'page_title' => $tempPages['2'],
        'menu_title' => $menu_title,
        'capability' => $tempPages['1'],
        'menu_slug' => $tempPages['2'],
        'name' => basename($className),
    );
 }

$pagesArray = array();
foreach($pagesArrayTemp as $tempPage){
    $pagesArray[] = $tempPage;
}
$this->pages = $pagesArray;
add_menu_page(PLUGIN_NAME, PLUGIN_NAME, $pagesArray[0]['capability'], $pagesArray[0]['menu_slug'], array($this, 'menu_pages'));
foreach($pagesArray as $page){
    add_submenu_page($pagesArray[0]['menu_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array($this, 'menu_pages'));
}


protected function menu_pages() {
    foreach($this->pages as $page){
        if($page['menu_slug'] == $_GET['page']){
            $capability = $page['capability'];
            $pageName = $page['name'];
        }
    }

    if ( empty($capability) || !current_user_can( $capability ) )  {
        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    }
    require_once(dirname(__FILE__).'/services/'.$pageName);
}

I know this is not a clean way but since i did not find any other solution this is what i came up with.

Hopes that helps someone.