Jump to content

'explode' in a loop


cliftonbazaar

Recommended Posts

I wanted a 2 dimensional array of information for a game I was building but found out on the Internet that it could not be 'imploded' into a database.

 

So i made 12 arrays, one for each player, instead of a team array $team[12][31].

 

Now when I goto explode it I thought I would go through a loop

	  //for($line_up=1; $line_up < 12; $line_up++)  {
    $playerArray.$line_up = explode(",", $match[$homeTeam.$line_up]);  //Get the player from the database
  }  	

the loop breaks as soon as it completes the first explode.  I found out this the easy way by putting

echo "$line_up";

in the loop and it only showed up once when run; comment out the explode line and the echo $line_up shows 1-12 (as it should).

 

Is there any way around this or a better way?

Link to comment
https://forums.phpfreaks.com/topic/188618-explode-in-a-loop/
Share on other sites

Explain what data you need to store and we might be able to help you with a better design.

Each team has about 35 statistics and anywhere from 16-25 players; each player has 31 statistics.  My design currently is to have each player as an array of their own stats.

 

If someone can help me with the explode loop problem that would allow me to keep going in this area; if another design concept is suggested then i would welcome it.

Link to comment
https://forums.phpfreaks.com/topic/188618-explode-in-a-loop/#findComment-995989
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.