// Create a new instance of a class based on its name $class_name = "MyClass"; $obj = $class_name::newFromName();
// Create a new instance of a class based on a variable name $class_name = $_REQUEST['class_name']; $obj = $class_name::newFromName();Both of these examples show how you can use the newFromName method in PHP to create a new instance of a class based on a dynamically determined name. This method is commonly used in PHP libraries such as the WordPress core, which includes the newFromName method as part of its core API.