I have a function, called function($parameter) for the example. I want this function to call another function, different depending on the parameter.
My code today:
function($parameter)
{
if($parameter == "A")
{
fctA();
}
elseif($parameter == "B")
{
fctB();
}
elseif($parameter == "C")
{
fctC();
}
}
// etc.
// There is a long list. Really long. Imagine that goes to ZZZZZ.
The "inside" function is always named in the same way. For the example, fctA(), fctB()... What is inside these functions is totally different the one with another.
Could I do better than that looooong list of "if" ? Using a variable into a function name seems impossible... but if there is a better method, I am eager to read about it! :)
Maybe I'm missing something obvious, any tips welcomed, I'm still learning!
Thanks a lot!
