Example
Create an object and output the value of one of its properties:
html
<?php
class MyClass {
public $name = "John";
}
$obj = new
MyClass();
echo "The name is " . $obj->name;
?>
Definition and Usage
The new keyword is used to create an object from a class.