PHP code example of aheinze / scriptlite-ext
1. Go to this page and download the library: Download aheinze/scriptlite-ext library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aheinze / scriptlite-ext example snippets
$engine = new ScriptLiteExt\Engine();
$result = $engine->eval('Math.max(1, 2, 3)');
echo $result; // 3
$engine = new ScriptLite\Engine();
$result = $engine->eval('Math.max(1, 2, 3)'); // uses C extension transparently
ini
extension=scriptlite
bash
php -r "var_dump(extension_loaded('scriptlite'));"
# bool(true)
php -r "echo (new ScriptLiteExt\Engine())->eval('1 + 2');"
# 3