3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Wl\A; class B { public function get() { return "BBBBB"; } } $b = new B(); $funct = function (B $b) { print_r($b::get()); }; $refParam = new \ReflectionParameter($funct, 0); $export = \ReflectionParameter::export( array( $refParam->getDeclaringClass()->name, $refParam->getDeclaringFunction()->name ), $refParam->name, true ); $type = preg_replace('/.*?(\w+)\s+\$'.$refParam->name.'.*/', '\\1', $export); echo "ARGS:\n"; echo $type; exit; try { $a->b(""); } catch (\Exception $e) { echo "catched"; } catch (\TypeError $e) { echo "subidubi"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
Found catch point at position: 42
Branch analysis from position: 42
2 jumps found. (Code = 107) Position 1 = 43, Position 2 = 45
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
2 jumps found. (Code = 107) Position 1 = 46, Position 2 = -2
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 45
Branch analysis from position: 45
filename:       /in/CMZT6
function name:  (null)
number of ops:  48
compiled vars:  !0 = $b, !1 = $funct, !2 = $refParam, !3 = $export, !4 = $type, !5 = $a, !6 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $7      'Wl%5CA%5CB'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $7
   12     3        DECLARE_LAMBDA_FUNCTION                                  '%00wl%5Ca%5C%7Bclosure%7D%2Fin%2FCMZT6%3A12%240'
          4        ASSIGN                                                   !1, ~10
   15     5        NEW                                              $12     'ReflectionParameter'
          6        SEND_VAR_EX                                              !1
          7        SEND_VAL_EX                                              0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $12
   16    10        INIT_STATIC_METHOD_CALL                                  'ReflectionParameter', 'export'
   18    11        INIT_METHOD_CALL                                         !2, 'getDeclaringClass'
         12        DO_FCALL                                      0  $15     
         13        FETCH_OBJ_R                                      ~16     $15, 'name'
         14        INIT_ARRAY                                       ~17     ~16
   19    15        INIT_METHOD_CALL                                         !2, 'getDeclaringFunction'
         16        DO_FCALL                                      0  $18     
         17        FETCH_OBJ_R                                      ~19     $18, 'name'
         18        ADD_ARRAY_ELEMENT                                ~17     ~19
         19        SEND_VAL_EX                                              ~17
         20        CHECK_FUNC_ARG                                           
   21    21        FETCH_OBJ_FUNC_ARG                               $20     !2, 'name'
         22        SEND_FUNC_ARG                                            $20
   22    23        SEND_VAL_EX                                              <true>
         24        DO_FCALL                                      0  $21     
   16    25        ASSIGN                                                   !3, $21
   24    26        INIT_NS_FCALL_BY_NAME                                    'Wl%5CA%5Cpreg_replace'
         27        FETCH_OBJ_R                                      ~23     !2, 'name'
         28        CONCAT                                           ~24     '%2F.%2A%3F%28%5Cw%2B%29%5Cs%2B%5C%24', ~23
         29        CONCAT                                           ~25     ~24, '.%2A%2F'
         30        SEND_VAL_EX                                              ~25
         31        SEND_VAL_EX                                              '%5C1'
         32        SEND_VAR_EX                                              !3
         33        DO_FCALL                                      0  $26     
         34        ASSIGN                                                   !4, $26
   26    35        ECHO                                                     'ARGS%3A%0A'
   27    36        ECHO                                                     !4
   28    37      > EXIT                                                     
   32    38*       INIT_METHOD_CALL                                         !5, 'b'
         39*       SEND_VAL_EX                                              ''
         40*       DO_FCALL                                      0          
         41*       JMP                                                      ->47
   33    42  E > > CATCH                                                    'Exception', ->45
   34    43    >   ECHO                                                     'catched'
         44      > JMP                                                      ->47
   35    45  E > > CATCH                                       last         'TypeError'
   36    46    >   ECHO                                                     'subidubi'
   37    47    > > RETURN                                                   1

Function %00wl%5Ca%5C%7Bclosure%7D%2Fin%2FCMZT6%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CMZT6
function name:  Wl\A\{closure}
number of ops:  8
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        INIT_NS_FCALL_BY_NAME                                    'Wl%5CA%5Cprint_r'
          2        FETCH_CLASS                                   0  $1      !0
          3        INIT_STATIC_METHOD_CALL                                  $1, 'get'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0          
          7      > RETURN                                                   null

End of function %00wl%5Ca%5C%7Bclosure%7D%2Fin%2FCMZT6%3A12%240

Class Wl\A\B:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CMZT6
function name:  get
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   'BBBBB'
    7     1*     > RETURN                                                   null

End of function get

End of class Wl\A\B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.32 ms | 1400 KiB | 17 Q