Edit report at https://bugs.php.net/bug.php?id=64300&edit=1
ID: 64300 Updated by: ni...@php.net Reported by: jyoung at mycarepro dot com Summary: Varible Property Retrivel -Status: Open +Status: Not a bug Type: Bug Package: Class/Object related Operating System: Windows 8 PHP Version: 5.4.12 Block user comment: N Private report: N New Comment: The -> operator is left associative, so $p->$this->b is interpreted as ($p->$this)->b. Instead you should write $p->{$this->b} to get the desired effect. Previous Comments: ------------------------------------------------------------------------ [2013-02-25 23:16:47] jyoung at mycarepro dot com Description: ------------ Varible Property Retrivel Test script: --------------- class y{ public $u = 123; } class a{ public $b = null; public function __construct($test){ $this->b = $test; } public function $c(){ $p = new y(); $p->u; //Works $p->$this->b; //Causes Error??? $tmp = $this->b; $p->$tmp; //Works } } $xyz = new a('u'); $xyz->c(); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64300&edit=1