The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> function through variable in PHP?
CodeKing
post Jan 26 2008, 08:01 PM
Post #1


Advanced Member
****

Group: Members
Posts: 175
Joined: 12-September 06
Member No.: 118



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Jan 27 2008, 03:51 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 09:46 AM