function my_module_exec() { // code to be executed } function hook_getHookModuleExecList($hook) { if ($hook == 'my_hook') { return array('my_module_exec'); } }
function hook_getHookModuleExecList($hook) { if ($hook == 'my_remove_hook') { $module_list = array('existing_module_exec', 'module_to_remove', 'another_module_exec'); $module_list = array_diff($module_list, array('module_to_remove')); return $module_list; } }In this example, we have defined a hook "my_remove_hook" that will remove the module execution "module_to_remove" from the list. We use the array_diff function to create a new array without the "module_to_remove" function and return it. The getHookModuleExecList hook is commonly used in CMS frameworks and package libraries such as Drupal, WordPress, and Joomla.