So i have a php class and i'm having a small snarl up. imagine a class as one shown below
<?php
class Foo
{
public function __construct()
{
$this->bar1();
}
public function bar1()
{
$myvar = 'Booya!';
return 'Something different';
}
public function bar2()
{
//get value of $myvar from bar1()
}
}
$new_foo = new Foo();
$new_foo->bar2();
?>
Question is,
how do I access the variable $myvar
from bar1()
keeping in mind that bar1()
returns something different.