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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: projektas at gmail dot com
New email:
PHP Version: OS:

 

 [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-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 17:05:53 2023 UTC