Hi!
Sory for my bad english.

Is it posible to make in php a html compiler (program that will check if there is lexical or semantic mistakes)?
(eg. If someone write: "<html><haed>", the program will check and write message that is error in code and that must be writen "<html><head>").
Thanks!

It's possible, although there are many already out there. If you just need one to use, google "HTML syntax checker".

If you really wanted to make one yourself, it would be a fairly extensive project. In the simplest form, you'd have to assemble a list of every HTML tag, and make your own parser(using regular expressions) to check for any bad tags.