Help - Search - Members - Calendar
Full Version: function through variable in PHP?
HTMLHelp Forums > Programming > Server-side Scripting
CodeKing
Anyway to do something like this?

CODE

function hello() {
    echo 'hello';
}

function run_func($func) {
     //Run the function set to $func
}

$hello_func = hello;

run_func($hello_func);


You can do it in javascript. Can you do it in PHP?
Brian Chandler
Have you looked in the php manual? That's normally the way to do programming - read the specification of what the programming language does, rather than just guessing.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.