l95theses Posted July 12, 2007 Share Posted July 12, 2007 I'm able to get the $itemg to be a recognized variable to check for, but when i try to change the $ceitem1_array items into a dynamic variable and make it like this $itemg2 = "citem" . $itemnum2 . "_array[0]"; that doesn't work becuase it never seems to evaluate true. This is the loop snippet of code that i wrote that works correctly. while ( $itemnum < 20 ) { if ( $$itemg == $citem1_array[0] ) { echo "$citem1_array[1] - $citem1_array[2]"; echo "<br>"; } $itemnum = $itemnum + 1; $itemg = "item" . $itemnum; } Link to comment https://forums.phpfreaks.com/topic/59577-getting-php-to-recognize-my-dynamic-variable/ Share on other sites More sharing options...
cooldude832 Posted July 12, 2007 Share Posted July 12, 2007 $itemg2 = "citem" . $itemnum2 . "_array[0]"; what is that?? that echoes out nonsense to me Also you don't really understand array usage that well I think because you have a while loop that doesn't at all use the $itemnum properly. Link to comment https://forums.phpfreaks.com/topic/59577-getting-php-to-recognize-my-dynamic-variable/#findComment-296050 Share on other sites More sharing options...
btherl Posted July 12, 2007 Share Posted July 12, 2007 Try this inside your loop (or outside.. the more places the better) print $itemg . " = " $$itemg . "\n"; Does everything look like it should? Link to comment https://forums.phpfreaks.com/topic/59577-getting-php-to-recognize-my-dynamic-variable/#findComment-296178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.