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 .

Manjunath Hegde
  • 404
  • 4
  • 21

3 Answers3

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);
Wayne Whitty
  • 19,513
  • 7
  • 44
  • 66
  • 1
    Just few seconds fast...You got the result.+1 for you – GautamD31 Aug 27 '13 at 10:09
  • 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 – Alma Do Aug 27 '13 at 10:14
  • 1
    @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. – Wayne Whitty Aug 27 '13 at 10:19
  • 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) – Alma Do Aug 27 '13 at 10:21
  • Because this question have to be rather closed as a duplicate? – Your Common Sense Aug 27 '13 at 10:23
1

Try with get_defined_functions() like

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

See this LINK

GautamD31
  • 28,552
  • 10
  • 64
  • 85
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>';
?>
Pupil
  • 23,834
  • 6
  • 44
  • 66