Download src/php/php-src/ext/ffi/tests/038.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 355 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/038.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/ffi/tests/038.phpt
-
curl -L -o 038.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/038.phpt
355 Bytes
| --TEST-- | |
| FFI 038: Casting array to pointer | |
| --EXTENSIONS-- | |
| ffi | |
| --INI-- | |
| ffi.enable=1 | |
| --FILE-- | |
| $ffi = FFI::cdef(); | |
| $a = $ffi->new("int[10]"); | |
| for ($i = 0; $i < 10; $i++) { | |
| $a[$i] = $i; | |
| } | |
| $p = $ffi->cast("int*", $a); | |
| var_dump($p[0]); | |
| var_dump($p[2]); | |
| vaR_dump($p) | |
| --EXPECTF-- | |
| int(0) | |
| int(2) | |
| object(FFI\CData:int%d_t*)#%d (1) { | |
| [0]=> | |
| int(0) | |
| } | |