1

I want to get all of the controllers and their methods in a single array.

For example, the following code in my inventory controller:

public function get_all_methods()
{
    echo '<pre>';
    print_r(get_class_methods($this));
    echo '</pre>';
}

Gives this output:

Array
(
      [0] => __construct
      [1] => index
      [2] => add_product
      [3] => edit_product
      [4] => delete_product
)

But i want something like this:

Array
(
    [Inventory] => Array
        (
            [0] => __construct
            [1] => index
            [2] => add_product
            [3] => edit_product
            [4] => delete_product
        )
    [Invoice] => Array
        (
            [0] => __construct
            [1] => index
            [2] => create_invoice
            [3] => invoice_list
        )
)

And how can i remove some known methods like __construct and index from the output array?

Md. Khairul Hasan
  • 704
  • 1
  • 10
  • 21

0 Answers0