3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($a, $b = 'default') {} $ref = new ReflectionFunction('test'); $params = $ref->getParameters(); foreach($params as $k => $v) { try { $d = $v->getDefaultValue(); } catch(Exception $e) { $d = "<none>"; } printf("%s: %s(%s)\n", $k, $v->isOptional() ? 'true' : 'false', $d); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 29
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
Branch analysis from position: 24
filename:       /in/HCS1k
function name:  (null)
number of ops:  31
compiled vars:  !0 = $ref, !1 = $params, !2 = $v, !3 = $k, !4 = $d, !5 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $6      'ReflectionFunction'
          1        SEND_VAL_EX                                              'test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
    6     4        INIT_METHOD_CALL                                         !0, 'getParameters'
          5        DO_FCALL                                      0  $9      
          6        ASSIGN                                                   !1, $9
    8     7      > FE_RESET_R                                       $11     !1, ->29
          8    > > FE_FETCH_R                                       ~12     $11, !2, ->29
          9    >   ASSIGN                                                   !3, ~12
   12    10        INIT_METHOD_CALL                                         !2, 'getDefaultValue'
         11        DO_FCALL                                      0  $14     
         12        ASSIGN                                                   !4, $14
         13      > JMP                                                      ->16
   14    14  E > > CATCH                                       last         'Exception'
   16    15    >   ASSIGN                                                   !4, '%3Cnone%3E'
   19    16    >   INIT_FCALL                                               'printf'
         17        SEND_VAL                                                 '%25s%3A+%25s%28%25s%29%0A'
         18        SEND_VAR                                                 !3
         19        INIT_METHOD_CALL                                         !2, 'isOptional'
         20        DO_FCALL                                      0  $17     
         21      > JMPZ                                                     $17, ->24
         22    >   QM_ASSIGN                                        ~18     'true'
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~18     'false'
         25    >   SEND_VAL                                                 ~18
         26        SEND_VAR                                                 !4
         27        DO_ICALL                                                 
    8    28      > JMP                                                      ->8
         29    >   FE_FREE                                                  $11
   20    30      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HCS1k
function name:  test
number of ops:  3
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'default'
          2      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150 ms | 1400 KiB | 15 Q