Different output depending on page


How can I have a different output depending on what page I am on? e.g

if index.php
echo ‘You are on index’

elseif portfolio.php
echo ‘You are on portfolio’

Take a look at the output of:

var_dump( $_SERVER );

You can get the page name from the url or put a variable at the top of your page with its name and then use switch to read or include the relavent page.