arrays - PHP - Complex variable setting based on passed variable -
so, have several variables array. have background arrays randomized, , draws picture based on background. have function that's used this. note number definition in call command useless:
function definebg($typ,$numb,$name,$artist,$horalign,$veralign){ global $defbacks,$defbacka,$defbackh,$defbackv; $numbr=max(count($defbacks),count($defbacka),count($defbackh),count($defbackv)); $defbacks[$numbr]=$name; $defbacka[$numbr]=$artist; $defbackh[$numbr]=$horalign; $defbackv[$numbr]=$veralign; } definebg($typ,$num,$name,$artist,$allignment_h,$allignment_v);
now, here's things interesting. want set several array values based on preference. there 3 types: a, b, , r. or b can passed call command, , function set or b depending on passed, set r regardless of passed, since r no preference. there can more 1 prefrence (in case i'll assume 3), call pass "abb". if case, mean each letter, define array like:
$defbacks_abb=$name $defbacks_rrr=$name $defbacks_arr=$name $defbacks_rbr=$name
...etc
so, how can perform this? unsure how use value of variable in variable name arrays.
Comments
Post a Comment