Download src/php/php-src/ext/ffi/tests/037.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 363 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/037.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/ffi/tests/037.phpt
-
curl -L -o 037.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/037.phpt
363 Bytes
| --TEST-- | |
| FFI 037: Type memory management | |
| --EXTENSIONS-- | |
| ffi | |
| --INI-- | |
| ffi.enable=1 | |
| --FILE-- | |
| function foo($ptr) { | |
| $buf = FFI::cdef()->new("int*[1]"); | |
| $buf[0] = $ptr; | |
| //... | |
| return $buf[0]; | |
| } | |
| $int = FFI::cdef()->new("int"); | |
| $int->cdata = 42; | |
| var_dump(foo(FFI::addr($int))); | |
| --EXPECTF-- | |
| object(FFI\CData:int32_t*)#%d (1) { | |
| [0]=> | |
| int(42) | |
| } | |