ID: 29515
User updated by: borivoje at gmail dot com
Reported By: borivoje at gmail dot com
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 4.3.8
New Comment:
I had no intention to confuse here, But...
I called this as a function from include file (these lines are in
function). As a saparated example it works just fine. But when I call
it from a function it displays error.
Previous Comments:
------------------------------------------------------------------------
[2004-08-04 19:51:17] borivoje at gmail dot com
<?php
$string = "helo,here,is,an,example";
$paragraphs = explode(",", $string);
$position = 10;
while (list($index, $thing) = each($paragraphs)) {
echo $position;
// here anything...
}
?>
------------------------------------------------------------------------
[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