Jump to content

Recommended Posts

Does anyone know if there is already something similar to inspect.getargspec() for PHP? or has anyone written anything?

 

essentially, this is what I need. Say you have a function:

 

function foo($A, $B, C='4'){

return "got it";

}

 

I need to find out what the arguments are named. In this case it is "$A" and "$B" and "$C" (or ideally $C = '4').

 

In C you can do something along these lines...

 

In Python, you can do it with getargspec(function_name) ... Here's an example:

 

>>> import inspect
>>> def foo(A, B, C=100):
... pass
...
>>> inspect.getargspec(foo)
(['A', 'B', 'C'], None, None, (100,))

 

Anyone ever make such an extension or function for PHP and willing to share? Or if anyone has pointers.

 

Link to comment
https://forums.phpfreaks.com/topic/54238-inspectgetargspec-for-php/
Share on other sites

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.