php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16 problem print in a for loop....
Submitted: 1998-01-27 23:07 UTC Modified: 1998-02-12 01:04 UTC
From: Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0b3 OS: Solaris 2.5.1
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:
New email:
PHP Version: OS:

 

 [1998-01-27 23:07 UTC]
/* Here is the the setup of my vars, the array is loaded
   up in some sql code not represented here.  It loads up
   fine
*/

$fieldstr =     "id title prod_key filename bytes last_mod ".
                "loc_type status_type type_type ram hd_mb ".
                "sound_type mhz_type proc_type blurb";
 
$fieldarr = explode(" ", $fieldstr);

$arraylen = count($fieldarr); 

/* This for loop does not put put a "<BR>\n" at the end
   of every line.
*/
for ($i = 0; $i < $arraylen; $i++) {
        $line = "$fieldarr[$i] = " . $$fieldarr[$i] . "<BR>\n";
        print("$line");
}

/* but the following does */
for ($i = 0; $i < $arraylen; $i++) {
        $line = "<BR>\n$fieldarr[$i] = " . $$fieldarr[$i];
        print("$line");
}


/* Any ideas? */ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-02-12 01:04 UTC] rasmus
I am unable to reproduce this.  I am using the above script and it gives me <BR>'s after each line in
both loops.  Please try running this exact script.  Perhaps you overlooked something and aren't
telling us about all the factors.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC