PHP loop function help needed!
Posted: Mon Apr 16, 2007 1:32 pm
Hello,
I'm trying to get this code to work:
I need it to split the 5161516161,784684664864684 and run " echo "$item_number"; " twice, one for each item number.
So if $item_number="5161516161,784684664864684,15515151"; then the script is supposed to run " echo "$item_number"; " three times, one time for each item number.
Please help, how can I do that? What is wrong with my code/how should it be?
/Oskar
I'm trying to get this code to work:
Code: Select all
$item_number="5161516161,784684664864684";
$item_numbers = explode(",", $item_number);
foreach ($item_numbers as &$item_number) {
echo "$item_number";
)So if $item_number="5161516161,784684664864684,15515151"; then the script is supposed to run " echo "$item_number"; " three times, one time for each item number.
Please help, how can I do that? What is wrong with my code/how should it be?
/Oskar