xref: /php-src/ext/ffi/tests/038.phpt (revision 4acf0084)
1--TEST--
2FFI 038: Casting array to pointer
3--EXTENSIONS--
4ffi
5--INI--
6ffi.enable=1
7--FILE--
8<?php
9$ffi = FFI::cdef();
10
11$a = $ffi->new("int[10]");
12for ($i = 0; $i < 10; $i++) {
13    $a[$i] = $i;
14}
15$p = $ffi->cast("int*", $a);
16var_dump($p[0]);
17var_dump($p[2]);
18vaR_dump($p)
19?>
20--EXPECTF--
21int(0)
22int(2)
23object(FFI\CData:int%d_t*)#%d (1) {
24  [0]=>
25  int(0)
26}
27