3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bob = function(Google $x, $y = 10, $z = 'sponge bob'){ return $x + $y; }; $functionReflection = new ReflectionFunction($bob); $parameters = $functionReflection->getParameters(); foreach($parameters as $param) { echo $param->name . ' '; echo $param->getClass . ' '; echo var_export($param->isOptional(), true) . ' '; echo $param->isOptional() ? var_export($param->getDefaultValue(), true) : '-'; echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 40
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 40
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 36
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/rZFjF
function name:  (null)
number of ops:  42
compiled vars:  !0 = $bob, !1 = $functionReflection, !2 = $parameters, !3 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrZFjF%3A3%240'
          1        ASSIGN                                                   !0, ~4
    7     2        NEW                                              $6      'ReflectionFunction'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
    8     6        INIT_METHOD_CALL                                         !1, 'getParameters'
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !2, $9
   10     9      > FE_RESET_R                                       $11     !2, ->40
         10    > > FE_FETCH_R                                               $11, !3, ->40
   11    11    >   FETCH_OBJ_R                                      ~12     !3, 'name'
         12        CONCAT                                           ~13     ~12, '+'
         13        ECHO                                                     ~13
   12    14        FETCH_OBJ_R                                      ~14     !3, 'getClass'
         15        CONCAT                                           ~15     ~14, '+'
         16        ECHO                                                     ~15
   13    17        INIT_FCALL                                               'var_export'
         18        INIT_METHOD_CALL                                         !3, 'isOptional'
         19        DO_FCALL                                      0  $16     
         20        SEND_VAR                                                 $16
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $17     
         23        CONCAT                                           ~18     $17, '+'
         24        ECHO                                                     ~18
   14    25        INIT_METHOD_CALL                                         !3, 'isOptional'
         26        DO_FCALL                                      0  $19     
         27      > JMPZ                                                     $19, ->36
         28    >   INIT_FCALL                                               'var_export'
         29        INIT_METHOD_CALL                                         !3, 'getDefaultValue'
         30        DO_FCALL                                      0  $20     
         31        SEND_VAR                                                 $20
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $21     
         34        QM_ASSIGN                                        ~22     $21
         35      > JMP                                                      ->37
         36    >   QM_ASSIGN                                        ~22     '-'
         37    >   ECHO                                                     ~22
   15    38        ECHO                                                     '%0A'
   10    39      > JMP                                                      ->10
         40    >   FE_FREE                                                  $11
   16    41      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FrZFjF%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rZFjF
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $x, !1 = $y, !2 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      10
          2        RECV_INIT                                        !2      'sponge+bob'
    4     3        ADD                                              ~3      !0, !1
          4      > RETURN                                                   ~3
    5     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrZFjF%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.76 ms | 1400 KiB | 15 Q