Re: [PHP4BETA] Some references issues

From: Date: Sun, 09 May 1999 09:37:03 +0000
Subject: Re: [PHP4BETA] Some references issues
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-698@lists.php.net to get a copy of this message
At 00:03 09/05/99 , Andrey Zmievski wrote:
I noticed that you can't use & to specify reference for hash value: $a = 9; $ar = array("a" => &$a); Can this feature be added? And this produces parse error: "expecting ')'" $a = 9; $ar = array(&$a); Is that parse error correct?
Well, it's correct in the sense that the current grammar does not support this notation. Only '$foo = &$bar' is supported (&$bar alone is meaningless, you can't do 'print &$bar', for example, so you can't do array("a" => &$a) either). References are a very risky business, and they (in addition to reference counts) introduced the most complicated problem we had to sort out with Zend. I'll have to discuss it with Andi to see if we can't find any possible problems with adding this notation. If it's safe, it should be trivial to support. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il -- PHP 4 Beta

« previous php.version4 (#698) next »