Download src/php/php-src/ext/ffi/tests/009.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 646 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/009.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/ffi/tests/009.phpt
-
curl -L -o 009.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/ffi/tests/009.phpt
646 Bytes
| --TEST-- | |
| FFI 009: memcpy(), memcmp(), memset() and sizeof() | |
| --EXTENSIONS-- | |
| ffi | |
| --INI-- | |
| ffi.enable=1 | |
| --FILE-- | |
| $ffi = FFI::cdef(); | |
| $a = $ffi->new("int[3]"); | |
| $a[1] = 10; | |
| $a[2] = 20; | |
| $b = $ffi->new("int[4]"); | |
| var_dump(FFI::memcmp($b, $a, FFI::sizeof($a))); | |
| FFI::memcpy($b, $a, FFI::sizeof($a)); | |
| var_dump($b); | |
| var_dump(FFI::memcmp($b, $a, FFI::sizeof($a))); | |
| FFI::memset($a, -1, FFI::sizeof($a)); | |
| var_dump($a); | |
| --EXPECTF-- | |
| int(-1) | |
| object(FFI\CData:int32_t[4])#%d (4) { | |
| [0]=> | |
| int(0) | |
| [1]=> | |
| int(10) | |
| [2]=> | |
| int(20) | |
| [3]=> | |
| int(0) | |
| } | |
| int(0) | |
| object(FFI\CData:int32_t[3])#%d (3) { | |
| [0]=> | |
| int(-1) | |
| [1]=> | |
| int(-1) | |
| [2]=> | |
| int(-1) | |
| } | |