The PRAjax class can be used to reflect PHPcode into JavaScript and Ajax methods and vice-versa. PHP objects can be used in JavaScript trough Ajax calls, both properties and (registered) functions.
PHP-O-Lait is a library that, in 2 boiler-plate lines of code, allows you to call server-side PHPcode from client-side JavaScript. It's so easy, in fact, that you don't need to know how it does it (hint, it uses Ajax and JSON).