diff options
| author | Fuwn <[email protected]> | 2022-03-13 07:17:44 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-13 07:17:44 -0700 |
| commit | 58966d1102cc6baafd90269ab2523d3f6da98e55 (patch) | |
| tree | a48a0bef996bf2cef942a6d4a0b9ea23c668afe3 /examples/ffi.php | |
| download | archived-senpy-ffi-58966d1102cc6baafd90269ab2523d3f6da98e55.tar.xz archived-senpy-ffi-58966d1102cc6baafd90269ab2523d3f6da98e55.zip | |
feat(senpy_ffi): 0.1.0 :star:
Diffstat (limited to 'examples/ffi.php')
| -rw-r--r-- | examples/ffi.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/ffi.php b/examples/ffi.php new file mode 100644 index 0000000..cf22c4a --- /dev/null +++ b/examples/ffi.php @@ -0,0 +1,25 @@ +<?php + +$extension = (PHP_OS_FAMILY == "Darwin" ? "dylib" : "so"); + +$ffi = FFI::cdef( + "int status(void);", + "target/debug/libsenpy_ffi.$extension" +); + +$c_status = $ffi->status(); +$status; + +if ($c_status == 1): + $status = "up"; +elseif ($c_status == 0): + $status = "down"; +elseif ($c_status == -1): + $status = "not down, but unreachable"; +else: + $status = "unknown"; +endif; + +echo "status: api.senpy.club is " . $status . "\r\n"; + +?> |