// Helper function function get_server($var) { return isset($_SERVER[$var]) ? $_SERVER[$var] : ''; } function get_self() { return basename(get_server('PHP_SELF')); } function example_use() { if (get_self() == 'index.php') { print 'Welcome'; } }
Programming Tips - PHP: find the name of the current script
Date: 2009may22
Language: php
Q. PHP: find the name of the current script
A. Use the function below: