$stringa="nomepag.php";
$nome=substr($stringa,0,strlen($stringa)-4);

questo?