PHP Variable Naming

3 weeks ago 35
ARTICLE AD BOX

If I have several variables that are only differentiated by a numerical value within the variable name, is there a way to make the numerical value a variable itself and then pass that value to another variable? Not the best explanation, so let me try with an example:

<?php $_tbl = 2; $tbl_Fld_type = $tbl{$_tbl}Fld_type; // to make the updated variable $tbl2Fld_type $tbl_FormTypes = $tbl{$_tbl}FormTypes; // to make the updated variable $tbl2FormTypes

If there is a way to do it, I can't think of it. I'm also not sure it can even be done. Something along the lines of a variable variable; at least that's my basis for wondering if it was possible.

Read Entire Article