3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler( function ($code, $string) { throw new Exception($string, $code); } ); try { interface I1 {} interface I2 {} class A implements I1 { public function fn() { echo 'foo'; } } class B extends A implements I2 { public function fn($arg) { echo $arg; } } } catch (Exception $e) { // ignore } $b = new B(); var_dump($b instanceof I1); // outputs "bool(false)" var_dump($b instanceof I2); // outputs "bool(false)" var_dump(class_implements('B')); // outputs "array(1) { 'I1' => string(2) "I1" }" $b->fn('bar'); // outputs "bar"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
filename:       /in/fkbOC
function name:  (null)
number of ops:  31
compiled vars:  !0 = $e, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'set_error_handler'
    4     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfkbOC%3A4%240'
          2        SEND_VAL                                                 ~2
          3        DO_ICALL                                                 
    7     4        DECLARE_CLASS                                            'i1'
    8     5        DECLARE_CLASS                                            'i2'
    9     6        DECLARE_CLASS                                            'a'
   12     7        DECLARE_CLASS                                            'b', 'a'
          8      > JMP                                                      ->10
   15     9  E > > CATCH                                       last         'Exception'
   18    10    >   NEW                                              $4      'B'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $4
   19    13        INIT_FCALL                                               'var_dump'
         14        INSTANCEOF                                       ~7      !1, 'I1'
         15        SEND_VAL                                                 ~7
         16        DO_ICALL                                                 
   20    17        INIT_FCALL                                               'var_dump'
         18        INSTANCEOF                                       ~9      !1, 'I2'
         19        SEND_VAL                                                 ~9
         20        DO_ICALL                                                 
   21    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'class_implements'
         23        SEND_VAL                                                 'B'
         24        DO_ICALL                                         $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
   22    27        INIT_METHOD_CALL                                         !1, 'fn'
         28        SEND_VAL_EX                                              'bar'
         29        DO_FCALL                                      0          
         30      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfkbOC%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/fkbOC
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $code, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        NEW                                              $2      'Exception'
          3        SEND_VAR_EX                                              !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
          7*     > RETURN                                                   null

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

Class I1: [no user functions]
Class I2: [no user functions]
Class A:
Function fn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fkbOC
function name:  fn
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'foo'
          1      > RETURN                                                   null

End of function fn

End of class A.

Class B:
Function fn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fkbOC
function name:  fn
number of ops:  3
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        ECHO                                                     !0
          2      > RETURN                                                   null

End of function fn

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.67 ms | 1405 KiB | 19 Q