In the string call function
PHP can call the function by the function name stored in the string. For example:
.NET can achieve this function?
<code class="language-php">$function_name = 'hello'; $function_name(); function hello() { echo 'hello'; }</code>
Yes.
It can be used to achieve this function. The method is as follows:Please note that the method of being called must have a public access decoration. For non -public methods, please use bindingflags parameters:
The above is the detailed content of Can C# Call a Function from a String?. For more information, please follow other related articles on the PHP Chinese website!