print and print_r in Drupal 7
It's the same as in other PHP applications with separate V layer - print and print_r, being directly PHP functions, don't know about anything in View layer of Drupal application. They cannot pass their output to theming chain, cache systems in place and so on. That said, they often works, but that's more a coincidence.

For array inspection, you should either use xdebug or, if you don't have time, patience or skill to set it up, use Devel module. Specifically, dpm, dvm, dpr and dvr functions will be useful for you. See this helpful demo page for details of their use.

TL;DR: Install Devel, replace print and print_r() calls with dvm(). Profit.