Search code examples
phpcallbackphp4

Do PHP variable functions work in PHP4?


I know you can do something like this in PHP5:

function sayHi() {
    echo "Hi!";
}

$func = "sayHi";
$func();

It is called a variable function in the documentation. But the docs don't say anything about what versions of PHP this works on. This could mean it works on ALL versions of PHP, but I doubt it. Specifically, does this work on PHP4?


Solution

  • For php 4.3 they are working. Build-in function test here, your source test here.