Using a framework or custom-built website offers much more freedom when it comes to optimizing certain processes. In order to offer maximum flexibility, CMS are often much more restrictive and include compulsory resource-sapping features.
This is why the CMS Drupal uses the concept of ‘hooks’ for its module system, which requires the functions within modules to follow a specific naming convention. However, testing to see which functions exist is a resource-consuming process, whereas custom-built websites do not need to ‘search’ for these functions as they are already known.
Avoid this type of implementation whenever possible:
<?php
foreach ($list as $module) {
if (function_exists($module . '_' . $hook)) {
// Do some stuff here...
}
}
?>