user324107
user324107

Reputation: 120

php call standard function by string

I need to call a PHP standard function from a string

Example:

$param = "parameter";
$functionname = "createimagefromjpg";
//call the function (with a parameter)

Anyone has an idea how I can do this? It can't be done with call_user_func() because it is a standard function.

Upvotes: 2

Views: 256

Answers (2)

JasonMichael
JasonMichael

Reputation: 2581

Correction, ok I thought this would work:

$$functionname($param);

but it does not.... the example with one dollar sign works for functions. Nice.

Upvotes: -1

Michael Mrozek
Michael Mrozek

Reputation: 175315

$functionname($param);

Upvotes: 5

Related Questions