Jump to content

Assigning values during a loop


RynMan

Recommended Posts

$arr = array();
foreach ($a as $b) {
  $arr[] = $b;
}

 

Thanks!

 

Then how would I basically get it to echo the contents until it was empty?

 

 

i.e. if there were 5 items in the array....have it do....

 

echo $Item[0];

echo $Item[1];

echo $Item[2];

echo $Item[3];

echo $Item[4];

 

without having to have the code for each array?  For example if my array size is always changing, I just want to echo what is there....

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.