As everyone knows WordPress makes it's API functions for example
get_header(); get_sidebar(); get_footer();
yet others since you may define in your functions.php file available any place in your theme files.
How can you create similar functionality because this in your exterior PHP programs/scripts without needing to write an include or require statement towards the top of every PHP file to gain access to your personal functions?
WordPress makes it's API functions and individuals defined inside your styles functions.php file constantly open to you, so that you can happily theme away without needing to include multiple files every time.
I realize the miracle begins with WordPress' index.php which in turn includes wordpress-blog-header.php after which wordpress-load.php and a lot of require/include claims are created at this time which setup the atmosphere making such functions open to us...
But I am getting trouble focusing on how WordPress serves the theme files although constantly tossing you back through it's original loop procedure for wordpress-blog-header.php and so on to make sure individuals functions are distributed around you...
I really hope this will make sense!
The theme files are incorporated, through the process you describe (index.php, etc.), following the files which contain individuals function definitions.