Advertisement

01.12.2006 at 07:52AM PST, ID: 21694040
[x]
Attachment Details

Using functions as arguments

Asked by leeprovoost in PHP Scripting Language

Tags: functions

Hi,

I want to be able to pass around functions. The problem is that something like this is not working:
function test (+,3,4)
I want the function test then apply + to 3 and 4.

So one of the ways to solve this I thought, is to change the function argument as a string, like this:
function test ("+", 3, 4)

The only problem is, how do I apply that function (which is a string now) to the variables? Or does someone have an other (better) approach?

Regards

LeeStart Free Trial
[+][-]01.12.2006 at 07:53AM PST, ID: 15682330

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.12.2006 at 07:59AM PST, ID: 15682402

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: functions
Sign Up Now!
Solution Provided By: Roonaan
Participating Experts: 3
Solution Grade: A
 
 
[+][-]01.12.2006 at 08:01AM PST, ID: 15682436

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.12.2006 at 08:13AM PST, ID: 15682574

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32