Do you mean to say that if a PHP file is saved as a .html file, the file will be taken as a html file until it means a PHP tag where, that portion would be compiled as a PHP file?
Talking about included files here--yes, in fact any file that is included will be treated that way. It doesn't matter about the extension when a file is included. That's why you need separate PHP tags in an included file. You can test this by including a file with some PHP code in it and leave out the tags. The server will merely echo the code as if it were html. As the manual says: "When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end."
And, any .class file is valid only when used in an include funtion?
Yes, by the same mechanism as above. Unless the server is configured to treat it the same as a .php file, e.g. in apache with an "AddType" declaration. Even then if it's an included file it's treated the same as above.