Skip to content

Commit 6e65750

Browse files
committed
add version
1 parent ab85c31 commit 6e65750

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

js/interactive-examples.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function createOutput(output) {
44
const container = document.createElement("div");
55
container.classList.add("screen", "example-contents");
66
const title = document.createElement("p");
7-
title.innerText = "Output: ";
7+
title.innerText = "Output (PHP "+ PHP.version +"):";
88
container.appendChild(title);
99
const div = document.createElement("div");
1010
div.classList.add("examplescode");
@@ -19,6 +19,7 @@ function createOutput(output) {
1919
class PHP {
2020
static buffer = [];
2121
static runPhp = null;
22+
static version = '';
2223
static async loadPhp() {
2324
if (PHP.runPhp) {
2425
return PHP.runPhp;
@@ -37,10 +38,8 @@ class PHP {
3738
},
3839
});
3940

40-
console.log(
41-
"PHP wasm %s loaded.",
42-
ccall("phpw_exec", "string", ["string"], ["phpversion();"]),
43-
);
41+
PHP.version = ccall("phpw_exec", "string", ["string"], ["phpversion();"]),
42+
console.log("PHP wasm %s loaded.", PHP.version);
4443
PHP.runPhp = (code) => ccall("phpw_run", null, ["string"], ["?>" + code]);
4544
return PHP.runPhp;
4645
}

0 commit comments

Comments
 (0)