Did you get this to work?
In response to your question. You will have to use the JCE editor and in the setting make sure to enable insert php in the configuration. Then when you enter the code editor at the top right make sure the drop down is set to code view.
I am not sure this will work though and an extension might have to be created in order to make it work right.
Let me know if you found a way to do this. If you are still interested and have not had any luck. I wold be willing to try and create an extension to make this work.