#47702 [NEW]: foreach (array(..) as &$value)

From: Date: Wed, 18 Mar 2009 06:14:38 +0000
Subject: #47702 [NEW]: foreach (array(..) as &$value)
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1997@lists.php.net to get a copy of this message
From:             jidanni at jidanni dot org
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  foreach (array(..) as &$value)

Description:
------------
In php-doc/html/control-structures.foreach.html
be sure to please mention that you can do

$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
    $value = $value * 2;
}

and

foreach (array(1, 2, 3, 4) as $value) {
    $value = $value * 2;
}

but not

foreach (array(1, 2, 3, 4) as &$value) {
    $value = $value * 2;
}

!


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



Thread (4 messages)

« previous php.doc.bugs (#1997) next »