3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface classThing { public function getClass(); public function setClass($class); } class Something implements classThing { private $class; public function setClass($class) { $this->class = $class; } public function getClass() { return $this->class; } } $header = array(new Something); if ($header[0] instanceof classThing && $class = $header[0]->getClass()) { echo $class; } else { echo 'not set'; } $header[0]->setClass('bla'); if ($header[0] instanceof classThing && $class = $header[0]->getClass()) { echo $class; } else { echo 'not set'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
Branch analysis from position: 29
Branch analysis from position: 13
filename:       /in/LoOdk
function name:  (null)
number of ops:  34
compiled vars:  !0 = $header, !1 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'something'
   12     1        NEW                                              $2      'Something'
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~4      $2
          4        ASSIGN                                                   !0, ~4
   14     5        FETCH_DIM_R                                      ~6      !0, 0
          6        INSTANCEOF                                       ~7      ~6, 'classThing'
          7      > JMPZ_EX                                          ~7      ~7, ->13
          8    >   FETCH_DIM_R                                      ~8      !0, 0
          9        INIT_METHOD_CALL                                         ~8, 'getClass'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                           ~10     !1, $9
         12        BOOL                                             ~7      ~10
         13    > > JMPZ                                                     ~7, ->16
   15    14    >   ECHO                                                     !1
         15      > JMP                                                      ->17
   18    16    >   ECHO                                                     'not+set'
   21    17    >   FETCH_DIM_R                                      ~11     !0, 0
         18        INIT_METHOD_CALL                                         ~11, 'setClass'
         19        SEND_VAL_EX                                              'bla'
         20        DO_FCALL                                      0          
   23    21        FETCH_DIM_R                                      ~13     !0, 0
         22        INSTANCEOF                                       ~14     ~13, 'classThing'
         23      > JMPZ_EX                                          ~14     ~14, ->29
         24    >   FETCH_DIM_R                                      ~15     !0, 0
         25        INIT_METHOD_CALL                                         ~15, 'getClass'
         26        DO_FCALL                                      0  $16     
         27        ASSIGN                                           ~17     !1, $16
         28        BOOL                                             ~14     ~17
         29    > > JMPZ                                                     ~14, ->32
   24    30    >   ECHO                                                     !1
         31      > JMP                                                      ->33
   27    32    >   ECHO                                                     'not+set'
   28    33    > > RETURN                                                   1

Class classThing:
Function getclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LoOdk
function name:  getClass
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   null

End of function getclass

Function setclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LoOdk
function name:  setClass
number of ops:  2
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function setclass

End of class classThing.

Class Something:
Function setclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LoOdk
function name:  setClass
number of ops:  4
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'class'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function setclass

Function getclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LoOdk
function name:  getClass
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'class'
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function getclass

End of class Something.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.25 ms | 1390 KiB | 13 Q