You are here: array_slice and for loop problem « PHP « IT news, forums, messages
array_slice and for loop problem

Posted by Rodney Green on 10/12/05 19:10

Hello,

I'm using a for loop to iterate through an array and slice parts of
the array and add into another array.

When array_slice is called the variable $i is not being substituted
with the current value of
$i and the $output array is empty after running the script. Can
someone look at the code below and give me a clue as to why this
substitution is not happening? If I uncomment the "echo $i;" statement
the value of $i is printed just fine.

Thanks,
Rod

Here's my code:


$number = count ($int_range[start]);
//echo $number;
for ($i = 0; $i <= $number; $i++) {

//echo $i;

$output = array_slice ($textArray, $int_range[start][$i],
$int_range[end][$i]);

}




foreach ($output as $value) {

echo $value;
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация