how i do to know if my file contains errors before include it on the script php
i want to know if exist function to know if my file have errors before include it just on the script as code bellow
if (file.php==errors ){echo"this file contain errors"} else { include("file.php");}
i want to use this php script to know if my file.php contain errors , if it contain't errors i will not include it , else i include it .
Answer
Solution:
No, it's not possible. If you include a script in another script, and then execute that script, then PHP evaluates the whole combined script as if it was one file. So if there is a syntax error in any of the included scripts it will cause the whole thing to fail. That, naturally, happens before any of your other code can run. Your whole concept simply doesn't make sense. If you have syntax errors, test the scripts and fix the syntax errors before the code goes live.
And, as the comments suggest, if the real issue is that some files do not get deployed properly, then the solution is to fix the issues which are causing the deployment to fail.
Source