How does PHP handle serialization of static properties in classes?

When serializing objects in PHP, static properties are not included by default. To include static properties in the serialization process, you can implement the magic __sleep() method in your class and manually include the static properties that you want to serialize.

class MyClass {
    public static $staticProperty = 'Hello';

    public function __sleep() {
        return array_merge(parent::__sleep(), ['staticProperty']);
    }
}