(PHP 7 >= 7.4.0)
FFI\CData objects can be used in a number of ways as a regular PHP data:
$x = FFI::new('int'); $x->cdata = 42;
$cdata->field
$cdata[$offset]
$cdata[0]
<
,
<=
, ==
, !=
, >=
, >
).
+
/-
/
++
/–-
operations, e.g. $cdata += 5
-
operations.
$cdata()
$cdata2 = clone $cdata;
Notă: Noteable limitations are that FFI\CData instances do not support isset(), empty() and unset(), and that wrapped C structs and unions do not implement Traversable.