Variable in Variable Mikrotik

Please sorry for my english i m not native english speaker.

Hello, i m trying to make a program what will check my bgp peers, i have set global variables (example 1 = 1 , 2 = 0) and i want make if with foreach. Simple i want make something like a “Variable what will call variable and display value of variable” in php is this named “Variable variables” and i can done it via $$variable-name. Is this possible in MikroTik?



Thanks for any help

Not possible.

And is possible to get a variable directly from /system script enviroment? Example via get? I tried it but i got empty responde

You should use an array for this. You can loop across an array using foreach. An array index can be a string.
:global ArrayName;

:set ($Arrayname->“value1”) 1;

Thanks man, i will try it

Array seems to work but how can i made example this? ($array->“$forVariable”) 1; This got empty or very strange output

In that case the variable must not be in quotes! ($array->$forvariable)
The evaluation of expressions in the scripting language is weird…