aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/rubyvm-on-php-on-wasm/php-wasm.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-07 12:54:36 +0900
committernsfisis <nsfisis@gmail.com>2024-07-07 12:54:36 +0900
commit378a315f15a26158885d4e1b14cb97cf04676ba9 (patch)
tree198c35341cef2aa1a1580bf354c8418fd09622ea /examples/rubyvm-on-php-on-wasm/php-wasm.php
parent6f6edf66a7ab9dcea07a34c66b459958376796a9 (diff)
downloadphp-waddiwasi-378a315f15a26158885d4e1b14cb97cf04676ba9.tar.gz
php-waddiwasi-378a315f15a26158885d4e1b14cb97cf04676ba9.tar.zst
php-waddiwasi-378a315f15a26158885d4e1b14cb97cf04676ba9.zip
chore: update README
Diffstat (limited to 'examples/rubyvm-on-php-on-wasm/php-wasm.php')
-rw-r--r--examples/rubyvm-on-php-on-wasm/php-wasm.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/rubyvm-on-php-on-wasm/php-wasm.php b/examples/rubyvm-on-php-on-wasm/php-wasm.php
index beb854f..704254f 100644
--- a/examples/rubyvm-on-php-on-wasm/php-wasm.php
+++ b/examples/rubyvm-on-php-on-wasm/php-wasm.php
@@ -20,7 +20,7 @@ use Nsfisis\Waddiwasi\Structure\Types\ValType;
const PHP_EMPTY = '';
const PHP_HELLO_WORLD = <<<'EOS'
-require_once __DIR__ . '/HelloWorld.php';
+require_once '%DIR%/HelloWorld.php';
EOS;
$wasmBinary = file_get_contents(__DIR__ . '/php-wasm.wasm');
@@ -135,7 +135,7 @@ foreach ($hostFuncs as $hostFunc) {
$externVals[] = ExternVal::Func(\count($store->funcs) - 1);
}
$runtime = Runtime::instantiate($store, $module, $externVals);
-$codePtr = allocateStringOnWasmMemory($runtime, PHP_HELLO_WORLD);
+$codePtr = allocateStringOnWasmMemory($runtime, strtr(PHP_HELLO_WORLD, ['%DIR%' => __DIR__]));
$results = $runtime->invoke("php_wasm_run", [$codePtr]);
\assert(\count($results) === 1);