cliftonbazaar Posted January 4, 2010 Share Posted January 4, 2010 $line_up=1; WHILE($player = mysql_fetch_array($players)) { $home'$line_up'[0]=$player['playerID']; $line_up++; } What I am trying to get is the variable $home1[0] to be the players ID. I have tried other variations of $home'$line_up'[0] but can't get it to work :'( Please note that I cannot create an array instead as it would create a multidimensional array and I have read that I can't implode() that. Link to comment https://forums.phpfreaks.com/topic/187102-creating-a-new-variable-name-by-combining-other-variable-names/ Share on other sites More sharing options...
trq Posted January 4, 2010 Share Posted January 4, 2010 An array would be allot more efficient, but whatever.... $line_up=1; WHILE($player = mysql_fetch_array($players)) { ${'home' . $line_up} = $player['playerID']; $line_up++; } Link to comment https://forums.phpfreaks.com/topic/187102-creating-a-new-variable-name-by-combining-other-variable-names/#findComment-988086 Share on other sites More sharing options...
JAY6390 Posted January 4, 2010 Share Posted January 4, 2010 I agree with thorpe. You should use an array. This is what arrays were designed for $home[$lineup] = $player['playerID']; Link to comment https://forums.phpfreaks.com/topic/187102-creating-a-new-variable-name-by-combining-other-variable-names/#findComment-988130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.