0
    <?php

    function funct_one(){
        //do something
    }
    function funct_two(){
        //do something
    }
    function funct_three(){
        //do something
    }
    function funct_four(){
        //do something
    }

     $func_list=array();
    ?> 

thats an example code

i want a list of all functions, something like this,

$func_list=array('funct_one','funct_two','funct_three','funct_four');

i want this array to generated itself on load .

0

3 Answers 3

5

get_defined_functions

get_defined_functions — Returns a multidimensional array containing a list of all defined functions, both built-in (internal) and user-defined. The internal functions will be accessible via $arr["internal"], and the user defined ones using $arr["user"]

Example:

function funct_four(){
    //do something
}

$arr = get_defined_functions();
var_dump($arr);
Sign up to request clarification or add additional context in comments.

5 Comments

Just few seconds fast...You got the result.+1 for you
Always wondered why in one case such answer (nearly link to manual) will be downvoted -3 and worse and in other cases - upvoted to +5 and better, while it always should be just a comment I guess :p Will not upvote/dowvote anyway :p
@AlmaDoMundo A comment isn't an answer though :p He asked a very specific question and it had a very specific answer. In my opinion, posting it as a comment would have defeated the purpose of Stackoverflow.
Link to manual is a specific answer? :p Not sure. Nevermind, just trying to clarify the criteria for myself (as I've seen many samples where such questions/answers were downvoted seriously instead)
Because this question have to be rather closed as a duplicate?
1

Try with get_defined_functions() like

$fun_arr = get_defined_functions();
print_r($fun_arr['user']);

See this LINK

8 Comments

print_r($fun_arr['user']); thank you.. :)
If so, then print_r(get_defined_functions()['user'])
@ManjunathHegde its better to accept Wayne Whitty ans bec its first ans rather than me
@ Alma Do Mundo : its a syntax error .. @Gautam i choose your answer brother..
@Gautam3164 - yes, i know :( And to be honest - I can't understand why maintain 5.3 or lower :\
|
0
<?php
function myrow($id, $data)
{
    return "<tr><th>$id</th><td>$data</td></tr>\n";
}

$arr = get_defined_functions();
echo '<pre>';
print_r($arr);
echo '</pre>';
?>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.