There is a global variable named $_SERVER['PHP_SELF'] that contains the name of your page currently requested. Combined with basename() this should work:
if( basename($_SERVER['PHP_SELF'], '.php') == 'contact' ) {
// Contact page
} else {
// Some other page
}