ID: 37584 Comment by: baby dot bjorn at yahoo dot com Reported By: daniel dot forero at hotmail dot com Status: Open Bug Type: Class/Object related Operating System: windows, linux PHP Version: 5.1.4 New Comment:
It's $this->nombre not $this->$nombre Previous Comments: ------------------------------------------------------------------------ [2006-05-25 00:56:38] daniel dot forero at hotmail dot com Description: ------------ I have a class that have a constructor function, you can study the code, the result of execute the script is diferent for the expect Reproduce code: --------------- <?php class usuario { var $nombre; var $edad; var $cargo; function set_name($name) { $this->$nombre=$name; } function usuario() { $this->$nombre="(Undefined)"; $this->$edad=0; $this->$cargo="(not a charge)"; } } $daniel = new usuario; $daniel->set_name("daniel"); echo $daniel->$nombre; echo '<br>'; echo $daniel->$edad; echo '<br>'; echo $daniel->$cargo; ?> Expected result: ---------------- daniel 0 (not a charge) Actual result: -------------- daniel daniel daniel ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37584&edit=1