ID:               29515
 User updated by:  borivoje at gmail dot com
 Reported By:      borivoje at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP
 PHP Version:      4.3.8
 New Comment:

<?php
$string = "helo,here,is,an,example";
$paragraphs = explode(",", $string);
$position = 10;

while (list($index, $thing) = each($paragraphs)) {
  echo $position;
  // here anything...
}
?>


Previous Comments:
------------------------------------------------------------------------

[2004-08-04 07:56:14] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.

------------------------------------------------------------------------

[2004-08-04 02:12:32] borivoje at gmail dot com

Description:
------------
http://www.code-experts.com/listTopic.asp?tid=44

Reproduce code:
---------------
    echo $poss . ' -  positions<br/>';

    $paragraphs = explode("\n",$textToReplace);
        $ord = 0;
    
        while (list($breakIndex,$breakToReplace) = each($paragraphs)) {
          echo $poss . "<br/>"; // <------    here
          echo $breakIndex . "-" . $ord . "<br/>";
          if ($breakIndex % $poss = 0) {
                $ord = $ord + 1;
                if ($ord = 1) $paragraphs[$breakIndex] = "<p class='news_preview'>".
$breakToReplace . "<img class='news_pic_r'
src='$picDir/$article->picturePath1'/></p>";
                if ($ord = 2) $paragraphs[$breakIndex] = "<p class='news_preview'>".
$breakToReplace . "<img class='news_pic_l'
src='$picDir/$article->picturePath2'/></p>";
                if ($ord = 3) $paragraphs[$breakIndex] = "<p class='news_preview'>".
$breakToReplace . "<img class='news_pic_r'
src='$picDir/$article->picturePath3'/></p>";
          } else {
            $paragraphs[$breakIndex] = "<p class=\"news_preview\">".
$breakToReplace ."</p>";
          }     
        }


Expected result:
----------------
All ones (1 int)

Actual result:
--------------
First one then 0-oes


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29515&edit=1

Reply via email to