3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface intf{ public function setVar($a); public function getVar(); } class A implements intf{ private $A; public function setVar($a){ $this->A=$a; } public function getVar(){ return $this->A; } } class B extends Abs{ private $B; public function setVar($a){ $this->B=$a; } public function getVar(){ return $this->B; } } abstract class Abs{ abstract public function setVar($a); abstract public function getVar(); public function getDouble($a){ return $a*2; } } $A=new A(); $B=new B(); $A->setVar(2); echo ' Class A: '.$A->getVar(); $B->setVar(4); echo ' Class B: '.$B->getVar(); echo ' Class B Double: '.$B->getDouble($B->getVar());
based on jlZB7
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  (null)
number of ops:  35
compiled vars:  !0 = $A, !1 = $B
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
   7     1        DECLARE_CLASS                                    $3      'a'
         2        ADD_INTERFACE                                            $3, 'intf'
         3        VERIFY_ABSTRACT_CLASS                                    $3
  17     4        FETCH_CLASS                                   0  :4      'Abs'
         5        DECLARE_INHERITED_CLASS                          $5      'b', $4
  29     6        NOP                                                      
  36     7        NEW                                              $7      :3
         8        DO_FCALL                                      0          
         9        ASSIGN                                                   !0, $7
  37    10        NEW                                              $10     :5
        11        DO_FCALL                                      0          
        12        ASSIGN                                                   !1, $10
  38    13        INIT_METHOD_CALL                                         !0, 'setVar'
        14        SEND_VAL_EX                                              2
        15        DO_FCALL                                      0          
  39    16        INIT_METHOD_CALL                                         !0, 'getVar'
        17        DO_FCALL                                      0  $14     
        18        CONCAT                                           ~15     '+Class+A%3A+', $14
        19        ECHO                                                     ~15
  40    20        INIT_METHOD_CALL                                         !1, 'setVar'
        21        SEND_VAL_EX                                              4
        22        DO_FCALL                                      0          
  42    23        INIT_METHOD_CALL                                         !1, 'getVar'
        24        DO_FCALL                                      0  $17     
        25        CONCAT                                           ~18     '+Class+B%3A+', $17
        26        ECHO                                                     ~18
  44    27        INIT_METHOD_CALL                                         !1, 'getDouble'
        28        INIT_METHOD_CALL                                         !1, 'getVar'
        29        DO_FCALL                                      0  $19     
        30        BRK                                                      
        31        DO_FCALL                                      0  $20     
        32        CONCAT                                           ~21     '+Class+B+Double%3A+', $20
        33        ECHO                                                     ~21
        34      > RETURN                                                   1

Class intf:
Function setvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  setVar
number of ops:  2
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
         1      > RETURN                                                   null

End of function setvar

Function getvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  getVar
number of ops:  1
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E > > RETURN                                                   null

End of function getvar

End of class intf.

Class A:
Function setvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  setVar
number of ops:  4
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   RECV                                             !0      
  10     1        ASSIGN_OBJ                                               'A'
         2        OP_DATA                                                  !0
  11     3      > RETURN                                                   null

End of function setvar

Function getvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  getVar
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   FETCH_OBJ_R                                      $0      'A'
         1      > RETURN                                                   $0
  14     2*     > RETURN                                                   null

End of function getvar

End of class A.

Class B:
Function setvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  setVar
number of ops:  4
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  20     0  E >   RECV                                             !0      
  21     1        ASSIGN_OBJ                                               'B'
         2        OP_DATA                                                  !0
  22     3      > RETURN                                                   null

End of function setvar

Function getvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  getVar
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  25     0  E >   FETCH_OBJ_R                                      $0      'B'
         1      > RETURN                                                   $0
  26     2*     > RETURN                                                   null

End of function getvar

End of class B.

Class Abs:
Function setvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  setVar
number of ops:  2
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  30     0  E >   RECV                                             !0      
         1      > RETURN                                                   null

End of function setvar

Function getvar:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  getVar
number of ops:  1
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  31     0  E > > RETURN                                                   null

End of function getvar

Function getdouble:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/GIKcZ
function name:  getDouble
number of ops:  4
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  32     0  E >   RECV                                             !0      
  33     1        MUL                                              ~1      !0, 2
         2      > RETURN                                                   ~1
  34     3*     > RETURN                                                   null

End of function getdouble

End of class Abs.

Generated using Vulcan Logic Dumper, using php 7.3.0