Rule #1, don't create branches you don't need.
Rule #2, don't create nesting blocks (what JS re-re's called "closures" that have nothing to do with closing a damned thing) you don't need.
Rule #3, formatting is your friend.
Rule #4, when a function returns boolean true or false, you don't need to !== false on it.
if (
!empty(REQUEST[1]) &&
array_key_exists(REQUEST[1], MODULES)
) require_once(
MODULES[REQUEST[1]]['path'] . '/' . MODULES[REQUEST[1]]['file'] . '.php'
); else mainIndex($db);
Again, array_key_exists literally only returns boolean, so I've no clue why you had "!== false" on it.