What’s the best way to include PHP code in pages?

WordPress has a function for including template parts, which you can use for that purpose : get_template_part

You can also use include(TEMPLATEPATH . '/includes/myfunction.php');