Is there any elegant way to check if a file was included by using include/include_once/require/require_once or if the pag
include
include_once
require
require_once
I don't think get_included_files is the perfect solution, what if your main script included some other scripts before the check? My suggestion is to check whether __FILE__ equals realpath($argv[1]):
get_included_files
__FILE__
realpath($argv[1])