Download src/php/php-src/ext/ffi/tests/025.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/025.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/ffi/tests/025.phpt
-
curl -L -o 025.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/025.phpt
672 Bytes
| --TEST-- | |
| FFI 025: direct work with primitive types | |
| --EXTENSIONS-- | |
| ffi | |
| --INI-- | |
| ffi.enable=1 | |
| --FILE-- | |
| $ffi = FFI::cdef(); | |
| $x = $ffi->new("int"); | |
| $x->cdata = 5; | |
| var_dump($x); | |
| $x->cdata += 2; | |
| var_dump($x); | |
| echo "$x\n\n"; | |
| unset($x); | |
| $x = $ffi->new("char"); | |
| $x->cdata = 'a'; | |
| var_dump($x); | |
| $x->cdata++; | |
| var_dump($x); | |
| echo "$x\n\n"; | |
| unset($x); | |
| --EXPECTF-- | |
| object(FFI\CData:int32_t)#%d (1) { | |
| ["cdata"]=> | |
| int(5) | |
| } | |
| object(FFI\CData:int32_t)#%d (1) { | |
| ["cdata"]=> | |
| int(7) | |
| } | |
| 7 | |
| object(FFI\CData:char)#%d (1) { | |
| ["cdata"]=> | |
| string(1) "a" | |
| } | |
| object(FFI\CData:char)#%d (1) { | |
| ["cdata"]=> | |
| string(1) "b" | |
| } | |
| b | |