If I wanted all PHP removed from the front end (meaning not in views,
not in the body of blocks)
Then you would use template files. Create a template file (.tpl.php) for your view or for your block and put the php code there.
The template file goes in
If when you edit your block the url is
admin/structure/block/manage/block/8/configure which means the 8 is the block ID.
Then template file name is block--block--8.tpl.php
Copy the code in block.tpl.php file located in
/sites/all/themes/YourTheme/templates and paste it into your block--block--8.tpl.php file. Then add your custom php code somewhere in there.
Remember to clear/flush the Drupal cache to see changes.
For View's you could create a template (.tpl.php) file OR you could use template.php
It really depends on the use case to select which method is the best way to go. I would need more details about what your view's php code does in order to give you a proper solution.
PS: It is good that you're asking this as using the PHP Filter module or Views PHP is considered bad practice. See What are the downsides of using 'custom' PHP code in blocks, nodes, views-args, etc?