dis-bench / src /php /php-src /ext /ffi /tests /038.phpt
meddyrat's picture
Replace repository contents with the original corrected artifact
1e94262
Raw History Blame Contribute Delete
355 Bytes
--TEST--
FFI 038: Casting array to pointer
--EXTENSIONS--
ffi
--INI--
ffi.enable=1
--FILE--
<?php
$ffi = FFI::cdef();
$a = $ffi->new("int[10]");
for ($i = 0; $i < 10; $i++) {
$a[$i] = $i;
}
$p = $ffi->cast("int*", $a);
var_dump($p[0]);
var_dump($p[2]);
vaR_dump($p)
?>
--EXPECTF--
int(0)
int(2)
object(FFI\CData:int%d_t*)#%d (1) {
[0]=>
int(0)
}