I don't think you can do that at all with PHP because it need to be processed by the PHP engine (server side).
so, when i write php, it must be written down in the body, so when loaded it is able to communicate with the server?
so php functions cannot be called when you need them?
You can execute PHP in any part of your HTML page, for example witin the <head>
That's probably what would work for you.