Jump to content

Recommended Posts

Thanks but i'm not pretty sure if this is what i need.

 

What I need is checking how many parameters a function needs to be executed...before executing it =)

 

For example:

 

1. We want to execute function foo of class fooClass and provide an array of parameters

2. We check if the function foo of fooClass can be executed with the amount of parameters passed

3. If the array fits the number of required parameters, we execute it.

4. If not, we do not.

 

It has to be done from outside...

Thanks!

 

I've been reading it so far and I haven't figured out the way it might help me =(

 

Usually, when we execute a method without all required parameters, we get a warning message displayed in our browser, right?

 

I would like to make that an error  and do not displaying the result.

 

Example:

 

class foo {

 

      public function whatever($a, $b) { }

 

}

 

So if we try to execute foo::whatever(4,5) it works, but if i try to execute foo::whatever(4) it throws an execution error insted of a warning.

 

Maybe catching the exception like this?

 

try {

 

      foo::whatever(4);

 

} catch (Exception $e) {

 

      // Code here

 

}

 

Will that work?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.