Please wait while we load your page...
 

Announcements

PHP Manual :: Examples



Resource Types || V8Js || V8js || PHP Manual

Basic usage

Example #1 Basic Javascript execution

<?php

$v8 
= new V8Js();

/* basic.js */
$JS = <<< EOT
len = print('Hello' + ' ' + 'World!' + "\\n");
len;
EOT;

try {
  
var_dump($v8->executeString($JS'basic.js'));
} catch (
V8JsException $e) {
  
var_dump($e);
}

?>

The above example will output:

Hello World!
int(13)


Resource Types || V8Js || V8js || PHP Manual
Live Chat Not Available