oskare100 Posted April 16, 2007 Share Posted April 16, 2007 Hello, I'm trying to get this code to work: $item_number="5161516161,784684664864684"; $item_numbers = explode(",", $item_number); foreach ($item_numbers as &$item_number) { echo "$item_number"; ) 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 Link to comment https://forums.phpfreaks.com/topic/47273-php-loop-function-help-needed/ Share on other sites More sharing options...
per1os Posted April 16, 2007 Share Posted April 16, 2007 $item_number="5161516161,784684664864684"; $item_numbers = explode(",", $item_number); foreach ($item_numbers as $item_num) { echo "$item_num"; } Should work like a champ. Link to comment https://forums.phpfreaks.com/topic/47273-php-loop-function-help-needed/#findComment-230605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.