(PHP 7 >= 7.4.0, PHP 8)
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]
foreach statements.
$cdata[0]
<,
<=, ==, !=, >=, >).
+/-/
++/-- operations, e.g. $cdata += 5
- operations.
$cdata()
$cdata2 = clone $cdata;
Note: 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.
| Version | Description |
|---|---|
| 8.3.0 | FFI\CData can now be assigned to structs and fields. |