The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
question : a trick to call function from a variable
10-08-2016, 10:12 PM
Post: #1
question : a trick to call function from a variable
hello,
I have a function name in a variable, and I would like to call it, some one know how to do ?
example :
Code:

EXPORT myfct(x)
BEGIN
  PRINT(x);
END;

EXPORT test(fct)
BEGIN
  local call:=fct+"(123)";
  EVAL(call);
END;
Now, If I call test("myfct"), Iwant the function myfct to be called (with parameter 123)
But it does not works as I wanted :
it returns "myfct(123)" but does not execute it...
if someone can help me..
Thank you.

primer
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
question : a trick to call function from a variable - primer - 10-08-2016 10:12 PM



User(s) browsing this thread: 1 Guest(s)