3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyCharacter { /* some stuff here */ } class MyString { public function __construct(MyCharacter $char, array $type, int $foo, $bar) { /* do something useful here */ } } $method = new ReflectionMethod('MyString', '__construct'); foreach ($method->getParameters() as $param) { echo "Type hint for ".$param->getName()." is ".$param->getClass().".\r\n"; } ?>
based on uTYsM
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
Jump found. Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
Jump found. Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
Jump found. Position 1 = -2
Branch analysis from position: 21
filename:       /in/HJBvs
function name:  (null)
number of ops:  23
compiled vars:  !0 = $method, !1 = $param
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   4     1        NOP                                                      
  10     2        NEW                                              $4      :-6
         3        SEND_VAL_EX                                              'MyString'
         4        SEND_VAL_EX                                              '__construct'
         5        DO_FCALL                                      0          
         6        ASSIGN                                                   !0, $4
  11     7        INIT_METHOD_CALL                                         !0, 'getParameters'
         8        DO_FCALL                                      0  $7      
         9      > FE_RESET_R                                       $8      $7, ->21
        10    > > FE_FETCH_R                                               $8, !1, ->21
  12    11    >   INIT_METHOD_CALL                                         !1, 'getName'
        12        DO_FCALL                                      0  $9      
        13        CONCAT                                           ~10     'Type+hint+for+', $9
        14        CONCAT                                           ~11     ~10, '+is+'
        15        INIT_METHOD_CALL                                         !1, 'getClass'
        16        DO_FCALL                                      0  $12     
        17        CONCAT                                           ~13     ~11, $12
        18        CONCAT                                           ~14     ~13, '.%0D%0A'
        19        ECHO                                                     ~14
        20      > JMP                                                      ->10
        21    >   FE_FREE                                                  $8
        22      > RETURN                                                   1

Class MyCharacter: [no user functions]
Class MyString:
Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/HJBvs
function name:  __construct
number of ops:  5
compiled vars:  !0 = $char, !1 = $type, !2 = $foo, !3 = $bar
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   RECV                                             !0      
         1        RECV                                             !1      
         2        RECV                                             !2      
         3        RECV                                             !3      
   7     4      > RETURN                                                   null

End of function __construct

End of class MyString.

Generated using Vulcan Logic Dumper, using php 7.3.0