3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(PDO $foo = null, array $bar, int $x = 0) { } } $method = new ReflectionMethod(A::class, "foo"); $params = $method->getParameters(); foreach ($params as $param) { $type = $param->getType(); var_dump($type->isBuiltin(), $type->allowsNull(), (empty($type) ? "" : $type . " ") . $param->name); print PHP_EOL . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 32
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 32
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/int0g
function name:  (null)
number of ops:  34
compiled vars:  !0 = $method, !1 = $params, !2 = $param, !3 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $4      'ReflectionMethod'
          1        SEND_VAL_EX                                              'A'
          2        SEND_VAL_EX                                              'foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   10     5        INIT_METHOD_CALL                                         !0, 'getParameters'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !1, $7
   12     8      > FE_RESET_R                                       $9      !1, ->32
          9    > > FE_FETCH_R                                               $9, !2, ->32
   13    10    >   INIT_METHOD_CALL                                         !2, 'getType'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !3, $10
   14    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !3, 'isBuiltin'
         15        DO_FCALL                                      0  $12     
         16        SEND_VAR                                                 $12
         17        INIT_METHOD_CALL                                         !3, 'allowsNull'
         18        DO_FCALL                                      0  $13     
         19        SEND_VAR                                                 $13
         20        ISSET_ISEMPTY_CV                                         !3
         21      > JMPZ                                                     ~14, ->24
         22    >   QM_ASSIGN                                        ~15     ''
         23      > JMP                                                      ->26
         24    >   CONCAT                                           ~16     !3, '+'
         25        QM_ASSIGN                                        ~15     ~16
         26    >   FETCH_OBJ_R                                      ~17     !2, 'name'
         27        CONCAT                                           ~18     ~15, ~17
         28        SEND_VAL                                                 ~18
         29        DO_ICALL                                                 
   16    30        ECHO                                                     '%0A%0A'
   12    31      > JMP                                                      ->9
         32    >   FE_FREE                                                  $9
   17    33      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/int0g
function name:  foo
number of ops:  4
compiled vars:  !0 = $foo, !1 = $bar, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      0
    6     3      > RETURN                                                   null

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.89 ms | 1074 KiB | 14 Q