php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63376 wrong output
Submitted: 2012-10-28 14:55 UTC Modified: 2012-10-28 15:23 UTC
From: projektas at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.3.18 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 25 = ?
Subscribe to this entry?

 
 [2012-10-28 14:55 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-28 15:23 UTC] rasmus@php.net
Read the explanation in bug #29992
 [2012-10-28 15:23 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 00:01:30 2024 UTC