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

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

<?php

class test{
	public $x;
}

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

 // now print the data from x property

echo $result->x;


?>

Leave a Comment