Is your example code exactly what you tried? If so, then the following simple typo might be your issue:
$this->$prop = $myprop; // Remove the dollar sign for $this->prop $this->prop = $myprop;