bschultz Posted April 26, 2012 Share Posted April 26, 2012 I need to use a variable variable. I need: $row['pos_1'] $row['pos_2'] to use $i for the numbers I have this: if ($row{[pos_.$i]} == 'ad') which is throwing an error Parse error: syntax error, unexpected '[' Any ideas? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/261616-need-help-with-variable-variables/ Share on other sites More sharing options...
KevinM1 Posted April 26, 2012 Share Posted April 26, 2012 $row['pos_' . $i] is what you're looking for. Quote Link to comment https://forums.phpfreaks.com/topic/261616-need-help-with-variable-variables/#findComment-1340577 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.