Return values from included files

Something I did not know, but when I found it on this post, then I just realized that is include somewhere in PHP manual, so I quote from original manual entry.

“If called from the global scope, then execution of the current script file is ended. If the current script file was include()-ed or require()-ed, then control is passed back to the calling file. Furthermore, if the current script file was include()-ed, then the value given to return() will be returned as the value of the include() call. If return() is called from within the main script file, then script execution ends.”

Leave a Reply