array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'class.ffi-cdata.php', 1 => 'FFI\\CData', ), 'up' => array ( 0 => 'book.ffi.php', 1 => 'FFI', ), 'prev' => array ( 0 => 'ffi.typeof.php', 1 => 'FFI::typeof', ), 'next' => array ( 0 => 'class.ffi-ctype.php', 1 => 'FFI\\CType', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ffi/ffi.cdata.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(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]
$cdata[0]
<
,
<=
, ==
, !=
, >=
, >
).
+
/-
/
++
/–-
operations, e.g. $cdata += 5
-
operations.
$cdata()
$cdata2 = clone $cdata;
Nota: 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.
Versão | Descrição |
---|---|
8.3.0 | FFI\CData can now be assigned to structs and fields. |