I've got a list of variables. Let's call it a=1,b=2,c=3. I would like to pass the variable name to a function as a string and then retrieve its' value. Is there a way to achieve this in PHP? I', hoping to use this in page object pattern with Gherkin to pass a variable name to a gherkin step.
my_function('my_variable')and then have my_function read the value of$my_variablefrom memory?${'my_variable'}(stackoverflow.com/a/16339701/296555) but you'll still have to deal with scope issues. This approach is rarely a good idea.test stepto get the names of the arguments instead of adding unnecessary complexity to your application code? See an example here: stackoverflow.com/a/2692514/296555