3v4l.org

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

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

End of function %00%7Bclosure%7D%2Fin%2FAUAgO%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.42 ms | 1405 KiB | 15 Q