aboutsummaryrefslogtreecommitdiffhomepage
path: root/files/php-wasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'files/php-wasm.c')
-rw-r--r--files/php-wasm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/files/php-wasm.c b/files/php-wasm.c
new file mode 100644
index 0000000..c124af0
--- /dev/null
+++ b/files/php-wasm.c
@@ -0,0 +1,8 @@
+#include <emscripten.h>
+#include <Zend/zend_execute.h>
+
+int EMSCRIPTEN_KEEPALIVE php_wasm_run(const char* code) {
+ zend_result result =
+ zend_eval_string_ex(code, NULL, "php.wasm code", 1);
+ return result == SUCCESS ? 0 : 1;
+}