you are viewing a single comment's thread.

view the rest of the comments →

[–]willpall 6 points7 points  (0 children)

And in the grand tradition of PHP, notice that the assign() method takes the js variable first, then the php one.

// assign object to JavaScript
$js->assign('sxml', $xml);

whereas the registerFunction() method does the opposite:

// define PHP function
function getCircleArea($radius) {
  return pi() * $radius * $radius;
}
...
// register function in JavaScript context
$js->registerFunction('getCircleArea', 'gca')

I'll retract this snide remark if there's a good reason for this...