3v4l.org

run code in 300+ PHP versions simultaneously
<?php class social_button { private function social_facebook() { return 'Facebook'; } private function social_instagram() { return 'Instagram'; } private function social_twitter() { return 'Twitter'; } public function all() { $reflection = new \ReflectionObject($this); $prefix = 'social_'; $methods = array_filter($reflection->getMethods(), function (\ReflectionMethod $method) use ($prefix) { return 0 === strpos($method->getName(), $prefix); }); $results = array_map(function (\ReflectionMethod $method) { $name = $method->getName(); return $this->$name(); }, $methods); return $results; } } $button = new social_button(); var_dump($button->all());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTkOM
function name:  (null)
number of ops:  9
compiled vars:  !0 = $button
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   NEW                                              $1      'social_button'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   42     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'all'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function social_facebook

Function social_instagram:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTkOM
function name:  social_instagram
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   'Instagram'
   13     1*     > RETURN                                                   null

End of function social_instagram

Function social_twitter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTkOM
function name:  social_twitter
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   'Twitter'
   18     1*     > RETURN                                                   null

End of function social_twitter

Function all:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTkOM
function name:  all
number of ops:  23
compiled vars:  !0 = $reflection, !1 = $prefix, !2 = $methods, !3 = $results
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $4      'ReflectionObject'
          1        FETCH_THIS                                       $5      
          2        SEND_VAR_EX                                              $5
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   24     5        ASSIGN                                                   !1, 'social_'
   26     6        INIT_FCALL                                               'array_filter'
          7        INIT_METHOD_CALL                                         !0, 'getMethods'
          8        DO_FCALL                                      0  $9      
          9        SEND_VAR                                                 $9
         10        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         11        BIND_LEXICAL                                             ~10, !1
   28    12        SEND_VAL                                                 ~10
   26    13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !2, $11
   30    15        INIT_FCALL                                               'array_map'
         16        DECLARE_LAMBDA_FUNCTION                          ~13     [1]
   34    17        SEND_VAL                                                 ~13
         18        SEND_VAR                                                 !2
   30    19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !3, $14
   36    21      > RETURN                                                   !3
   37    22*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTkOM
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $method, !1 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   27     2        INIT_FCALL                                               'strpos'
          3        INIT_METHOD_CALL                                         !0, 'getName'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $3      
          8        IS_IDENTICAL                                     ~4      $3, 0
          9      > RETURN                                                   ~4
   28    10*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qTkOM
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $method, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        INIT_METHOD_CALL                                         !0, 'getName'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
   33     4        FETCH_THIS                                       $4      
          5        INIT_METHOD_CALL                                         $4, !1
          6        DO_FCALL                                      0  $5      
          7      > RETURN                                                   $5
   34     8*     > RETURN                                                   null

End of Dynamic Function 1

End of function all

End of class social_button.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.4 ms | 1013 KiB | 17 Q