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 server-side JS like Rhino but I have no idea how to include it to PHP.
Share
PHP has a V8 extension: http://php.net/manual/en/class.v8js.php never tried it that much, but might be useful
EDIT: here’s the pecl package link: http://pecl.php.net/package/v8js