Download src/php/php-src/ext/ffi/tests/024.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 621 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/024.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/ffi/tests/024.phpt
-
curl -L -o 024.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/024.phpt
621 Bytes
| --TEST-- | |
| FFI 024: anonymous struct/union | |
| --EXTENSIONS-- | |
| ffi | |
| --INI-- | |
| ffi.enable=1 | |
| --FILE-- | |
| $p = FFI::cdef()->new(" | |
| struct { | |
| int a; | |
| struct { | |
| int b; | |
| int c; | |
| }; | |
| union { | |
| int d; | |
| uint32_t e; | |
| }; | |
| int f; | |
| }"); | |
| var_dump(FFI::sizeof($p)); | |
| $p->a = 1; | |
| $p->b = 2; | |
| $p->c = 3; | |
| $p->d = 4; | |
| $p->f = 5; | |
| var_dump($p); | |
| --EXPECTF-- | |
| int(20) | |
| object(FFI\CData:struct <anonymous>)#%d (6) { | |
| ["a"]=> | |
| int(1) | |
| ["b"]=> | |
| int(2) | |
| ["c"]=> | |
| int(3) | |
| ["d"]=> | |
| int(4) | |
| ["e"]=> | |
| int(4) | |
| ["f"]=> | |
| int(5) | |
| } | |