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
 [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: Thu Feb 09 07:05:47 2023 UTC