Edit report at https://bugs.php.net/bug.php?id=63376&edit=1
ID: 63376 Updated by: [email protected] Reported by: projektas at gmail dot com Summary: wrong output -Status: Open +Status: Not a bug Type: Bug Package: Output Control Operating System: Linux PHP Version: 5.3.18 Block user comment: N Private report: N New Comment: Read the explanation in bug #29992 Previous Comments: ------------------------------------------------------------------------ [2012-10-28 14:55:03] projektas at gmail dot com Description: ------------ I can't understand why I'm getting wrong output http://codepad.org/nWTjjjV6 Test script: --------------- <?php $spell = array("double", "toil", "trouble", "cauldron", "bubble"); foreach ($spell as &$word) { $word = ucfirst($word); echo $word . "\n"; } echo "---\n"; foreach ($spell as $word) { echo $word . "\n"; } Expected result: ---------------- Double Toil Trouble Cauldron Bubble --- Double Toil Trouble Cauldron Bubble Actual result: -------------- Double Toil Trouble Cauldron Bubble --- Double Toil Trouble Cauldron Cauldron ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63376&edit=1
