FFI::new
(PHP 7 >= 7.4.0, PHP 8)
Creates a C data structure
Description
Creates a native data structure of the given C type. Any type declared for the instance is allowed.
Parameters
typetypeis a valid C declaration asstring, or an instance ofFFI\CTypewhich has already been created.ownedWhether to create owned (i.e. managed) or unmanaged data. Managed data lives together with the returned
FFI\CDataobject, 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 callingFFI::free, when no longer needed.persistentWhether to allocate the C data structure permanently on the system heap (using
malloc()), or on the PHP request heap (usingemalloc()).
Return Values
Returns the freshly created FFI\CData object, or null on failure.
Changelog
| Version | Description |
|---|---|
| 8.3.0 | Calling FFI::new statically is now deprecated. |