How To Update Data in a Property inside a Class From Outside in PHP Oops

Date Published: 08/04/2020 Published By: JaiSchool

This post is going to help you if you want to update data in a property (variable) of class in object-oriented programming from outside of the class in PHP. See example-


class test{
	public $x;

$result = new test();
$result->x = "Jaischool";

 // now print the data from x property

echo $result->x;


Publish A Comment

Leave a Reply

Your email address will not be published. Required fields are marked *