FFI::cast
(PHP 7 >= 7.4.0)
FFI::cast — Performs a C type cast
说明
FFI::cast() creates a new FFI\CData object, that references the same C data structure, but is associated with a different type. The resulting object does not own the C data, and the source ptr
must survive the result. The C type may be specified as a string with any valid C type declaration or as FFI\CType object, created before. If this method is called statically, it must only use predefined C type names (e.g. int, char, etc.); if the method is called as instance method, any type declared for the instance is allowed.
参数
返回值
Returns the freshly created FFI\CData object.