Answer by Davide Berra for how to create and concatenate dynamic variables in...
Yes you can. Just use brackets. Look at this example:<?php$one = 1;$suffix_one = "_".$one;$suffix_two = "_2";$base_1 = "VALUE ONE";$base_2 = "VALUE TWO";echo ${"base".$suffix_one}." ,...
View ArticleAnswer by Sean McSomething for how to create and concatenate dynamic...
Whenever somebody says "dynamic variables" it's a big red flag. You can do them but it's a bad idea 99% of the time. What you're probably looking for is an array. If you write:$menus =...
View ArticleAnswer by moonwave99 for how to create and concatenate dynamic variables in PHP?
You can use curly brackets for that:${'menu' . $i}but I strongly advise you just to echo the stuff you need inside the loop.Plus, mysql_* functions are deprecated - go either the PDO or the mysqli way...
View ArticleAnswer by user1941719 for how to create and concatenate dynamic variables in...
Why not use arrays instead?$menu[$i] = "\n\t$('#menu_" . $i . "').hover(function () {";
View Articlehow to create and concatenate dynamic variables in PHP?
In this php code, during a while loop, I was hoping to use later 3 variables called $menu_1, $menu_2, and $menu_3. Is this possible in PHP?while($parent_row = mysql_fetch_array($parent_result)){ $menu_...
View Article