Source Code:
(back to article)
<?php // Define a class named MyClass class MyClass { // Declare a public property named myVar public $myVar; } // Create a new instance of the class $obj = new MyClass(); // Assign a value to the myVar property $obj->myVar = "some value"; // Output the value of the myVar property echo "Value of myVar: " . $obj->myVar . "\n"; // Output: // Value of myVar: some value ?>
Result:
Report an issue