ID:               37584
 Updated by:       [EMAIL PROTECTED]
 Reported By:      daniel dot forero at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: windows, linux
 PHP Version:      5.1.4
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Access the properties without $ sign, like $this->nombre.


Previous Comments:
------------------------------------------------------------------------

[2006-05-25 05:50:00] baby dot bjorn at yahoo dot com

It's $this->nombre not $this->$nombre

------------------------------------------------------------------------

[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

Reply via email to