class someclass
{
public $foo = \'abcd\';
public function __construct($data)
{
$this->foo = $data;
}
public function doSomething()
{
It is correct and it works fine. I ran your code and it always gives me the same. There's no problem you have property $foo and $foo variable in one or multiple functions. It always give me the same answer.
If $_POST['foo']=test then echo $foo = $_POST['foo']; returns "test", $foo returns "test" and $somethingelse returns "test";