2

Generally we add the comment's on classes and function to explore the class and its functions.

LIKE:

/**
 * some descriptions
 * @params
 */
  class NewClass {
      /**
        * method description
        * @params
        */
      public function first(){

      }

      /**
        * method description
        * @params
        */
      public function second(){

      }
  }

I want to retrieve the comments on the PHP CLASS and RESPECTIVE CLASS FUNCTIONS.

Can anyone help me??

   The required output is::

array(0=>array( 'type'=>'class','comment'=>"/*** some descriptions* @params*/"),
      1=> array( 'type'=>'method','comment'=>"/*** method description* @params*/"),
      2=> array( 'type'=>'method','comment'=>"/*** method description* @params*/")
);
Álvaro González
  • 142,137
  • 41
  • 261
  • 360
user3305818
  • 184
  • 3
  • 15
  • 1
    Can you please clarify (the question is impossible to understand in its current form). Are you talking about DB comments? Or the comments inside the PHP class files? And also post some code on what you already tried? – mark Apr 28 '14 at 11:04
  • 1
    Why do you need that? – jack Apr 28 '14 at 11:05
  • Good question indeed.. @user3305818 Before you start reinventing the wheel (or even the world one day) - I suggest using http://www.phpdoc.org/ - if your plan is to extract doc blocks of PHP class files. Looking at their source code might also be the best way of finding out how it's done. In case you still want to (re)invent it on your own. – mark Apr 28 '14 at 11:07
  • Or you need to get it from a file_get_contents() ?? – Shijin TR Apr 28 '14 at 11:48

1 Answers1

0

From another stack overflow question

TLDR: version use the Reflection API

Community
  • 1
  • 1
CoolGoose
  • 508
  • 1
  • 5
  • 16