ID: 12596
Updated by: jeroen
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Feedback
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 4.0.5
New Comment:

This isn't supposed to work (class-var initing is not allowed for non-scalar (for 
example array) values).

It is funny that it turns out to work this way, a parse-error would be better IMO.

But it is not a bug, changing status to feedback.

It is in the manual somewhere that this isn't allowed, try language -> classes and 
object

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

[2001-08-06 09:41:56] [EMAIL PROTECTED]

The following piece of code doesn't work:

<?
    define ('A', 20);

    class B
    {
        var $a = array(A => 10);
    }

    $b = new B();
    var_dump($b);
?>

It produces:

object(b)(1) {
  ["a"]=>
  array(1) {
    ["A"]=>
    int(10)
  }
}

which is unexpected (at least for me).

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



Edit this bug report at http://bugs.php.net/?id=12596&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to