![]() |
|
|
+ Search |
![]()
|
Jul 29th, 2001 07:51
Steven Haryanto,
I am looking for the equivalent of Python's:
if __name__ == '__main__':
# i am invoked directly
else:
# i am included from some other file
Currently I use:
if (!in_array(realpath(__FILE__), get_included_files())) {
# i am invoked directly
} else {
# i am included from some other file
}
but wonder if there is a simple, faster, more elegant way (builtin
support from PHP perhaps?)