What are the differences between "ts" and "nts" in PHP extensions?

The main difference between "ts" and "nts" in PHP extensions is the thread safety of the extension. "ts" stands for "thread safe," meaning the extension can be used in a multi-threaded environment without issues. On the other hand, "nts" stands for "non-thread safe," indicating that the extension is not safe for use in a multi-threaded environment. To ensure compatibility with your PHP installation, it's important to select the appropriate version of the extension based on whether your PHP installation is thread safe or non-thread safe.

// Example of loading a thread safe extension
// Replace 'example_extension' with the actual name of the extension
if (PHP_ZTS) {
    dl('example_extension_ts.so');
} else {
    dl('example_extension_nts.so');
}