Calling JavaScript server-side from PHP

Yes, I know this is weird. But I've got a very slick (for JavaScript) function that I'd like to call. Basically, I'd like to pass it a string in a PHP plug-in and get a string back from the JavaScript script.

Any ideas how this might be done?

Thanks!