#!/usr/local/bin/php
<?php
class MyClass {
    protected $_who;
    public function __construct($who) {
        $this->_who = $who;
        var_dump($this);
    }
    public function sayHello() {
        var_dump($this);
        echo "Hello, {$this->_who}!\n";
    }
}

$ctx = new JSContext();
$ctx->registerClass('MyClass');

$js = file_get_contents(__DIR__ . '/registerClass.js');
$ctx->evaluateScript($js);

