<?php
$ctx = new JSContext();

$ctx->assign('entier', 42);
$ctx->assign('liste', array(10, 20, 30));
$ctx->assign('obj', (object)array(
    'a' => 10,
    'pi' => 3.1415,
    'str' => 'Hello, World!',
));

$obj2 = (object)array(
    'first' => 'Hello ',
    'second' => 'World!',
);
$ctx->assign('obj2', $obj2);

$js = file_get_contents(__DIR__ . '/test-assign-1.js');

$str = $ctx->evaluateScript($js);
echo $str;

var_dump($obj2);  // $obj2->second vaut maintenant 'There!' !
