How do I call a function using a function name generated from a string variable.
Posted
by Roeland
on Stack Overflow
See other posts from Stack Overflow
or by Roeland
Published on 2010-04-07T06:21:17Z
Indexed on
2010/04/07
6:33 UTC
Read the original article
Hit count: 261
php
|web-development
In the process of automating some code, I am looking to call upon a function based on what a string is.
For example, I have a variable $somevar
which is set to the string "This". Now I want to run a function doThis();
So, I was hoping I could write do.$somevar($var,$var2)
. I want it to run doThis($var1,$var2)
.
Is this possible?
© Stack Overflow or respective owner