From:             martin dot koranda at gmail dot com
Operating system: linux
PHP version:      5.2.5
PHP Bug Type:     Feature/Change Request
Bug description:  key in an array cannot be a reference in foreach loop

Description:
------------
in foreach loop, if i try to use keys as a reference, i'll get "Fatal
error: Key element cannot be a reference". my question is why not? can Zend
developers add the possibility of key element reference in the sixth PHP
version??

Reproduce code:
---------------
     foreach($arr as &$key => $val)
     {
      ...
     }

Expected result:
----------------
change keys inside the foreach loop

Actual result:
--------------
Fatal error: Key element cannot be a reference 

-- 
Edit bug report at http://bugs.php.net/?id=44180&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44180&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44180&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44180&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44180&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44180&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44180&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44180&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44180&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44180&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44180&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44180&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44180&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44180&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44180&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44180&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44180&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44180&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44180&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44180&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44180&r=mysqlcfg

Reply via email to