Vincent DUPONT wrote:
I need to load various php files programatically and I use require_once($file_path) 
for this purpose.
My question is : is there a way to know if the file was found or not? if the file 
generated an error or not?

RTFM: http://php.net/include


"require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error."

require_once and include_once behave in the same way.

You can check the return value from include() to see if it was successful. If the included file ends with a return statement then you will get that if it succeeds. If not you'll get the value 1 if it succeeds.

--
Stuart

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to