class MyClass { public static $myStaticProperty = "Hello World!"; } // Access the property echo MyClass::$myStaticProperty; // Output: Hello World! // Delete the property unset(MyClass::$myStaticProperty); // Access the property again echo MyClass::$myStaticProperty; // Output: Undefined property: MyClass::$myStaticProperty
class MyClass { public static function myStaticMethod() { return "Hello World!"; } } // Call the method echo MyClass::myStaticMethod(); // Output: Hello World! // Delete the method unset(MyClass::myStaticMethod); // Call the method again echo MyClass::myStaticMethod(); // Output: Fatal error: Uncaught Error: Undefined method MyClass::myStaticMethod()In this example, we define a static method in the MyClass class. We then call the method using the scope resolution operator (::) and print its value. We then delete the method using the unset() function and try to call it again, resulting in an error because the method no longer exists. The package library for PHP static delete method is PHP built-in functions.