in PHP 5 it would be
class Example {
private $foo = "old data";
public function __construct(){}
public function setVar($data){
$this->foo = $data;
}
public function output(){
return $this->foo;
}
}
$var = new Example();
$var->setVar("new data");
echo $var->output();
I never learned OO in PHP 4 and am having trouble finding where to do this. Working with a class that I have to extend a bit. Any searches on this shows me a ton of ways to do this in PHP5 but not 4
Thanks
See PHP Manual on Classes and Objects in PHP4 and Migrating from PHP 4 to PHP 5.0.x
class Example
{
var $foo = "old data";
function Example() {}
function setVar($data){
$this->foo = $data;
}
function output(){
return $this->foo;
}
}
$var = new Example();
$var->setVar("new data");
echo $var->output();