I'm not sure why you would like to do this. If configured, PHP will log PHP errors to your server's error.log file. (Apache)
Hy, You can use try..catch statement to capture the error in a variable, then to use it as you want. Look on the net for "try catch php".