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
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:
11 + 28 = ?
Subscribe to this entry?

 
 [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.
 [2019-11-14 19:05 UTC] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=348296
Log: Improve PHP_FLOAT_MIN doc

Patch by BenMorel.

Closes php/doc-en#16.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 15:01:28 2024 UTC