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