Call Javascript functions from PHP <p>A common problem is that for validation you need to run the same code on the server and on the client. On a JavaScript heavy page there are many other function you like to share between both sides. Since you can't run PHP on the client I wounder if it's possible to run a Javascript function from PHP. I am thinking about <a href="http://en.wikipedia.org/wiki/Server-side_JavaScript" rel="nofollow">server-side JS</a> like <a href="http://en.wikipedia.org/wiki/Rhino_%28JavaScript_engine%29" rel="nofollow">Rhino</a> but I have no idea how to include it to PHP.</p>