*SOLVED* PHP Yet Again!!! -Multidimensional arrays-
Page 1 of 1
sTo0z
[Moderator] Babysitter



Posts: 7449
Location: USA
PostPosted: Mon, 8th Aug 2005 19:30    Post subject: *SOLVED* PHP Yet Again!!! -Multidimensional arrays-
Code:
for( $i = 0; $i < $individuals; $i++ )
{
   for( $j = 0; $j < $features; $j++ )
   {
      $var = mt_rand( 0, 1 );
      $population[i][j] = $var;
   }
}

for( $i = 0; $i < $individuals; $i++ )
{
   for( $j = 0; $j < $features; $j++ )
   {
      echo $population[i][j];
   }
}



Alright, got that code goin on, I'm trying to fill that multi dimensional array with 1's and 0's.

The random # is generating fine, and the element of the array WHEN IT GOES IN is fine, but when I loop through and print it out, it's either ALL 1's or ALL 0's.

Can someone help me out? I would forever be in your debt.

EDIT:

Yah I'm a fool and forgot a few $'s in my arrays, damn variables... I'm soooooooooo tired. Time for bed. Razz


Back to top
Voodoo-child
VIP Member



Posts: 1502
Location: Belgium
PostPosted: Tue, 9th Aug 2005 15:28    Post subject:
what app are you using for the php-scripting? or just plain notepad? Smile
thx
Back to top
sTo0z
[Moderator] Babysitter



Posts: 7449
Location: USA
PostPosted: Tue, 9th Aug 2005 15:56    Post subject:
Dreamweaver Mad


Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group