bschultz Posted November 13, 2013 Share Posted November 13, 2013 I'm have a hard time figuring out variable variables. if (${$pos_$i} == '1234') So, the $i is in a loop... The full variables are $pos_1, $pos_2, $pos_3 etc. How can get this to work? The code above throws a Parse error: syntax error, unexpected T_VARIABLE in... error. Thanks! Quote Link to comment Share on other sites More sharing options...
bschultz Posted November 13, 2013 Author Share Posted November 13, 2013 Why is it you always find the right Google phrase AFTER you post the questions? ${'pos_' . $i} Quote Link to comment Share on other sites More sharing options...
Solution AbraCadaver Posted November 13, 2013 Solution Share Posted November 13, 2013 Did google tell you that there is rarely if EVER a good reason to use variable variables? Use an array: if ($pos[$i] == '1234') Post more code if you are still unsure. Quote Link to comment 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.