xref: /PHP-8.3/ext/ffi/tests/011.phpt (revision 4acf0084)
1--TEST--
2FFI 011: cast()
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9$ffi = FFI::cdef();
10
11$a = $ffi->new("uint8_t[4]");
12$a[0] = 255;
13$a[1] = 255;
14var_dump($ffi->cast("uint16_t[2]", $a));
15?>
16--EXPECTF--
17object(FFI\CData:uint16_t[2])#%d (2) {
18  [0]=>
19  int(65535)
20  [1]=>
21  int(0)
22}
23