xref: /PHP-8.3/ext/ffi/tests/006.phpt (revision 4acf0084)
1--TEST--
2FFI 006: Pointer assignment
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9$ffi = FFI::cdef();
10
11$v = $ffi->new("int*[2]");
12$v[1] = $ffi->new("int[1]", false);
13$v[1][0] = 42;
14var_dump($v);
15FFI::free($v[1]);
16var_dump($v);
17?>
18--EXPECTF--
19object(FFI\CData:int32_t*[2])#%d (2) {
20  [0]=>
21  NULL
22  [1]=>
23  object(FFI\CData:int32_t*)#%d (1) {
24    [0]=>
25    int(42)
26  }
27}
28object(FFI\CData:int32_t*[2])#%d (2) {
29  [0]=>
30  NULL
31  [1]=>
32  NULL
33}
34