Help forming an array!!!

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Mon Apr 07, 2003 4:37 am

$temp_count = -1;
$array_max = 7;
while(++$temp_count < $array_max)
{
$output_array[$temp_count] = $temp_count+1;
}

if you plugged $array_max = 3 into that, you'd get

$output_array[0] = 1;
$output_array[1] = 2;
$output_array[2] = 3;

personally I wouldn't build an array though, I'd just echo the <option tags within the while loop

{
echo '<option value="' .$temp_count. '">Page ' .$temp_count. '</option>
';
}
and start $temp_count = 0 instead.
avatar image based upon nasas apod (only updates if I post though)

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest