3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test{ /** * @cc hello A */ public function A(){ echo 'a'; } } echo "string"; function cc_get_desc($module,$fc){ // $act=A($module); $act = new $module(); $func = new ReflectionMethod($act,$fc); $tmp = $func->getDocComment(); $flag = preg_match_all('/@cc(.*?)\n/',$tmp,$tmp); $tmp = trim($tmp[1][0]); $tmp = $tmp !='' ? $tmp:'无'; return $tmp; } $tmp = cc_get_desc('test','A'); var_dump($tmp);//hello A
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jRBMG
function name:  (null)
number of ops:  10
compiled vars:  !0 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'string'
   25     1        INIT_FCALL                                               'cc_get_desc'
          2        SEND_VAL                                                 'test'
          3        SEND_VAL                                                 'A'
          4        DO_FCALL                                      0  $1      
          5        ASSIGN                                                   !0, $1
   26     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function cc_get_desc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jRBMG
function name:  cc_get_desc
number of ops:  34
compiled vars:  !0 = $module, !1 = $fc, !2 = $act, !3 = $func, !4 = $tmp, !5 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        FETCH_CLASS                                   0  $6      !0
          3        NEW                                              $7      $6
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $7
   15     6        NEW                                              $10     'ReflectionMethod'
          7        SEND_VAR_EX                                              !2
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $10
   16    11        INIT_METHOD_CALL                                         !3, 'getDocComment'
         12        DO_FCALL                                      0  $13     
         13        ASSIGN                                                   !4, $13
   18    14        INIT_FCALL                                               'preg_match_all'
         15        SEND_VAL                                                 '%2F%40cc%28.%2A%3F%29%5Cn%2F'
         16        SEND_VAR                                                 !4
         17        SEND_REF                                                 !4
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !5, $15
   19    20        INIT_FCALL                                               'trim'
         21        FETCH_DIM_R                                      ~17     !4, 1
         22        FETCH_DIM_R                                      ~18     ~17, 0
         23        SEND_VAL                                                 ~18
         24        DO_ICALL                                         $19     
         25        ASSIGN                                                   !4, $19
   20    26        IS_NOT_EQUAL                                             !4, ''
         27      > JMPZ                                                     ~21, ->30
         28    >   QM_ASSIGN                                        ~22     !4
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~22     '%E6%97%A0'
         31    >   ASSIGN                                                   !4, ~22
   22    32      > RETURN                                                   !4
   23    33*     > RETURN                                                   null

End of function cc_get_desc

Class test:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jRBMG
function name:  A
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'a'
    8     1      > RETURN                                                   null

End of function a

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.94 ms | 1403 KiB | 20 Q