FFI::new
(PHP 7 >= 7.4.0, PHP 8)
FFI::new — Creates a C data structure
Description
$type, bool $owned = true, bool $persistent = false): ?FFI\CDataCreates a native data structure of the given C type. Any type declared for the instance is allowed.
Parameters
type
type is a valid C declaration as string, or an
instance of FFI\CType which has already been created.
owned
Whether to create owned (i.e. managed) or unmanaged data. Managed data lives together with the returned FFI\CData object, and is released when the last reference to that object is released by regular PHP reference counting or GC. Unmanaged data should be released by calling FFI::free(), when no longer needed.
persistent
Whether to allocate the C data structure permanently on the system heap (using malloc()), or on the PHP request heap (using emalloc()).
Changelog
| Version | Description |
|---|---|
| 8.3.0 | Calling FFI::new() statically is now deprecated. |
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
