onClick, create php variable and echo out
Your title is not possible, as php can only run on the web server. The average computer can not process php.
However there is a couple things you could do. A real simpl one is to just have your function place a line of text into an existing element (including hidden elements) on your page using the innerHTML method.
Or for a bit fancier option create a <div> in your function. Then apply CSS to that div to set its position, top, float, padding, margin, borders, background, z-index, ect. And then place the text you want in the div, with some style. Then insert the div into the body with "document.body.innerHTML" to make the it look like its floating above your content.
In case you have never done the second option you will want to brush up on your CSS as while you are using javascript it will be CSS that does the real work.