What's the difference between $_SERVER['PHP_SELF'] and $_SERVER['SCRIPT_NAME']?

Viewed 11327

I have a php framework and I used $_SERVER['SCRIPT_NAME'] to optimize portability. That way I don't need to manually configure the path anymore.

$this->base_url = str_replace('index.php', '', 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);

But I noticed that $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF'] returns the exact same string. So, what's the difference? How should I choose between them?

2 Answers
Related