Welcome to SO,
As per your asking about Let me know if I'm not clear enough on the question., I love this one cause you are new to this site. Now lets go to the field.
You have a variable: $string = "ABCD";
, and also another is $A = 10;
, or $B = 10;
and so on.
What you really want to know is how to get the same value using the $string
values??
Solution:
The logic behind this is called variables.variable, Let you are using the index of the string.
$string = "ABCD"; // your variable
$A = 10; // your another variable
$B = 10; // may your another variable
Now, Let $string[0]
, In this variable we have the a value and the value is A
, So if we put a $
sign before this value then what will happen?? This will create a new variable and if you echo it you will get the value of this new created variable if the variable has a value.
Just do it: echo ${$string[0]};
// 10