Jump to content

[SOLVED] Noob foreach() question.


iPixel

Recommended Posts

Ok, $branchid variable can hold values such as  "5"  and  "5,23,6,3,40,9,14,18,33".

So my though was, if i explode() $branchid, then $bID would automatically become and array of the branchid's by breaking it up through the "," seperator.

 

Is my foreach bad? Why isnt this printing properly. My result is 33 for some reason instead of

5

23

6

3

40

9

14

18

33

 

Why does it pring  just the last value?

 

<?php
$bID = explode(",", $branchid);
foreach($bID as $key=> $value);
{
	echo $bID[$key] . "<BR>";
}
?>

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/178476-solved-noob-foreach-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.