First of all, the snippet of posted code, when put into a valid class context, doesn’t produce any syntax error in php7 (unless there’s something there that the forum software mangled.) The problem causing the syntax error is either due to the context where this code is at or is due to something at phptester. It would require having all the original code to even begin to be able to help. This is a PEAR extension. Which one? It may have been updated by the Author to work with php7?
Next, the syntax of $new was never valid for class creation. However, if the code was attempting to have a variable named $new with php version specific class creation syntax in it, this might explain the eval() usage (I would have used conditional logic, since there’s only two choices), but the string syntax would either have used double-quotes or concatenation. There’s nothing in the current posted code that requires the use of eval() and it should be eliminated, because if any of the values being put into the string could contain php/javascript, this code would allow either taking over your web site or doing cross site scripting.
If you literally changed PEAR_ERROR_EXCEPTION to PEAR_Exception in the posted code, that’s not what this code is trying to do and not what the user error message it produces means. It’s testing a bit in the mode property to see if an obsolete choice is being used. Once this code runs (it currently doesn’t due to the syntax error) and if it triggers the shown USER WARNING message, it means that the mode property needs to be changed. If on the other hand you did change the mode property, the current syntax error could be from some different code, rather than the posted code. Did you confirm that the file and line number in the latest error corresponds to the posted code?
Programming is context specific. Just making all errors go-away isn’t enough. You must consider what the context is, what the code is doing, when making changes.