function_passback2.phpt 508 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Test V8::executeString() : Call passed-back function (property access)
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $v8 = new V8Js();
  8. $JS = <<< EOT
  9. (function(exports) {
  10. // begin module code
  11. exports.hello = function() { return 'hello'; };
  12. // end module code
  13. return exports;
  14. })({})
  15. EOT;
  16. $exports = $v8->executeString($JS, 'basic.js');
  17. $v8->func = $exports->hello;
  18. echo $v8->executeString('PHP.func();')."\n";
  19. ?>
  20. ===EOF===
  21. --EXPECT--
  22. hello
  23. ===EOF===