Catch all global errors

I’m wanting to create an error handler for a PHP site.

Sadly, there are A LOT of pages, so adding error handling everywhere there could possibly be an error could get quite heavy, and I have already done most of the coding, so I’m too lazy to go back and change anything. :stuck_out_tongue:

Luckily, all pages go through the “index.php” page first, so is there any code I can add there (or anywhere else for that matter) that will run a specific function in case any errors occur?