(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;
注意: Notable limitations are that FFI\CData instances do not support isset(), empty() and unset(), and that wrapped C structs and unions do not implement Traversable.