Jump to content

setting array values inside a while loop


whittierpc

Recommended Posts

A better way is to do it in a for loop:

[code=php:0]
for ($x = 0; $x <= 10; $x++) {
    $arrayname[$x] = $x;
}
[/code]

What this would do is store all the numbers from 0 to 10 in the array, but I'm sure you'll figure it out for whatever you're trying to do.

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.