I'm working on a 400,403,404,500 system and wondered if there is a way to use a single page and have it display the proper error code on the php page when triggered by a specific event?

Example: a page not found, and the php page would show the proper code stating what happened?