note 120319 added to class.v8js
| From: | Hoffmann dot P-no-sp at m-gmx dot net | Date: | Tue, 13 Dec 2016 10:53:00 +0000 |
| Subject: | note 120319 added to class.v8js | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-208574@lists.php.net to get a copy of this message | ||
You can use function variables (jay!)
So the following works:
$add = function ($a, $b) {
return $a + $b;
};
$v8 = new V8Js('PHP', array('add' => 'add'));
$result = $v8->executeString('PHP.add(1,2)');
var_dump($result);
yields indeed:
int(3)
----
Server IP: 72.52.91.14
Probable Submitter: 141.35.244.175
----
Manual Page -- http://php.net/manual/en/class.v8js.php
Edit -- https://master.php.net/note/edit/120319
Del: integrated -- https://master.php.net/note/delete/120319/integrated
Del: useless -- https://master.php.net/note/delete/120319/useless
Del: bad code -- https://master.php.net/note/delete/120319/bad+code
Del: spam -- https://master.php.net/note/delete/120319/spam
Del: non-english -- https://master.php.net/note/delete/120319/non-english
Del: in docs -- https://master.php.net/note/delete/120319/in+docs
Del: other reasons-- https://master.php.net/note/delete/120319
Reject -- https://master.php.net/note/reject/120319
Search -- https://master.php.net/manage/user-notes.php