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 = 41
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 41
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 37
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/nvj0r
function name:  (null)
number of ops:  43
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%2Fnvj0r%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, ->41
         10    > > FE_FETCH_R                                               $11, !3, ->41
   11    11    >   FETCH_OBJ_R                                      ~12     !3, 'name'
         12        CONCAT                                           ~13     ~12, '+'
         13        ECHO                                                     ~13
   12    14        INIT_METHOD_CALL                                         !3, 'getClass'
         15        DO_FCALL                                      0  $14     
         16        CONCAT                                           ~15     $14, '+'
         17        ECHO                                                     ~15
   13    18        INIT_FCALL                                               'var_export'
         19        INIT_METHOD_CALL                                         !3, 'isOptional'
         20        DO_FCALL                                      0  $16     
         21        SEND_VAR                                                 $16
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $17     
         24        CONCAT                                           ~18     $17, '+'
         25        ECHO                                                     ~18
   14    26        INIT_METHOD_CALL                                         !3, 'isOptional'
         27        DO_FCALL                                      0  $19     
         28      > JMPZ                                                     $19, ->37
         29    >   INIT_FCALL                                               'var_export'
         30        INIT_METHOD_CALL                                         !3, 'getDefaultValue'
         31        DO_FCALL                                      0  $20     
         32        SEND_VAR                                                 $20
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $21     
         35        QM_ASSIGN                                        ~22     $21
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~22     '-'
         38    >   ECHO                                                     ~22
   15    39        ECHO                                                     '%0A'
   10    40      > JMP                                                      ->10
         41    >   FE_FREE                                                  $11
   16    42      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fnvj0r%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nvj0r
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%2Fnvj0r%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.17 ms | 1405 KiB | 15 Q