Comparing Data Using FFI
Learn how to compare data using FFI.
It’s important to keep in mind that when we create a C-language data structure using the FFI extension, it exists outside of our PHP application. PHP can interact with the C data to a certain extent. However, for comparison purposes, it’s best to use FFI::memcmp()
, as native PHP functions might return inconsistent results.
The two comparison functions available in the FFI extension are summarized here in the following table.
Get hands-on with 1400+ tech skills courses.