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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 20:01:30 2025 UTC