|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46027 extra <br />
Submitted: 2008-09-09 03:13 UTC Modified: 2008-09-09 13:35 UTC
From: thebeanieman at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.6 OS: Windows XP SP3
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.
Block user comment
Status: Assign to:
Bug Type:
From: thebeanieman at gmail dot com
New email:
PHP Version: OS:


 [2008-09-09 03:13 UTC] thebeanieman at gmail dot com

This is my code:


  $chemString = "H2O,3PO4.12WO3.XH2O,6H4(CH3)2,5H10O5";
  $chemString = trim($chemString);
  $offset = 0;
  $tempStr = "";

  for ($k=0;$k<mb_strlen($chemString);$k++){
      if ($k>0 && is_numeric(mb_substr($chemString,$k,1))){
          if (preg_match("/^[A-Z]+$/",mb_substr($chemString,$k-1,1))){
             $tempStr .= substr($chemString,$offset,1);
             $tempStr .= "<sub>".substr($chemString,$offset+1,1)."</sub>";
             $offset = $offset+3;
             echo "ggg".strlen($offset)."sss<br />";
        echo "<br />".$k;


This is the source:

<br />0ggg1sss<br /><br />1<br />2<br />3<br />4<br />5<br />6ggg1sss<br /><br />7<br />8<br />9<br />10<br />11<br />12ggg1sss<br /><br />13<br />14<br />15<br />16ggg2sss<br /><br />17<br />18<br />19<br />20<br />21ggg2sss<br /><br />22<br />23<br />24<br />25ggg2sss<br /><br />26<br />27<br />28<br />29<br />30<br />31ggg2sss<br /><br />32<br />33<br />34ggg2sss<br /><br />35

Expected result:
There is an extra <br /> tag. I know it's hard to see, but looks like a bug.

i.e "<br />0ggg1sss<br /><br />1<br />"  --- the <br /> in the middle came from nowhere!!


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-09 13:35 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Jun 05 21:03:37 2023 UTC