3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class namedClass{ protected $prop; public function __construct($value){ $this->prop = $value; } public function returnProperty($propName){ if( !empty($this->$propName) ){ return $this->$propName; }else{ return null; } } } $standardObject = new namedCLass('The named class'); echo $standardObject->returnProperty('prop')."\n"; class namedExtension extends namedClass{ public function returnProperty($propName){ if( !empty($this->$propName) ){ return $this->$propName.' from standard extenstion'; }else{ return null; } } } $extObject = new namedExtension('The named extension'); echo $extObject->returnProperty('prop')."\n"; $anonObj = new class('The anonymous class') extends namedClass{ public function returnProperty($propName){ if( !empty($this->$propName) ){ return $this->$propName.' from anonymous class'; }else{ return null; } } }; echo $anonObj->returnProperty('prop');
based on SiacH
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/iukUl
function name:  (null)
number of ops:  32
compiled vars:  !0 = $standardObject, !1 = $extObject, !2 = $anonObj
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  28     1        NEW                                              $4      :-6
         2        SEND_VAL_EX                                              'The+named+class'
         3        DO_FCALL                                      0          
         4        ASSIGN                                                   !0, $4
  30     5        INIT_METHOD_CALL                                         !0, 'returnProperty'
         6        SEND_VAL_EX                                              'prop'
         7        DO_FCALL                                      0  $7      
         8        CONCAT                                           ~8      $7, '%0A'
         9        ECHO                                                     ~8
  32    10        NOP                                                      
        11        NOP                                                      
  50    12        NEW                                              $11     :3
        13        SEND_VAL_EX                                              'The+named+extension'
        14        DO_FCALL                                      0          
        15        ASSIGN                                                   !1, $11
  52    16        INIT_METHOD_CALL                                         !1, 'returnProperty'
        17        SEND_VAL_EX                                              'prop'
        18        DO_FCALL                                      0  $14     
        19        CONCAT                                           ~15     $14, '%0A'
        20        ECHO                                                     ~15
  54    21        FETCH_CLASS                                   0  :16     'namedClass'
        22        <172>                                                    'class%40anonymous%00%2Fin%2Fiukul0x7f62d1e8150f'
        23        NEW                                              $18     :17
        24        SEND_VAL_EX                                              'The+anonymous+class'
        25        DO_FCALL                                      0          
        26        ASSIGN                                                   !2, $18
  72    27        INIT_METHOD_CALL                                         !2, 'returnProperty'
        28        SEND_VAL_EX                                              'prop'
        29        DO_FCALL                                      0  $21     
        30        ECHO                                                     $21
        31      > RETURN                                                   1

Class namedClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/iukUl
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   RECV                                             !0      
   8     1        ASSIGN_OBJ                                               'prop'
         2        OP_DATA                                                  !0
  10     3      > RETURN                                                   null

End of function __construct

Function returnproperty:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
Jump found. Position 1 = -2
Branch analysis from position: 7
Jump found. Position 1 = -2
filename:       /in/iukUl
function name:  returnProperty
number of ops:  9
compiled vars:  !0 = $propName
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  12     0  E >   RECV                                             !0      
  14     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      !0
         2        BOOL_NOT                                         ~2      ~1
         3      > JMPZ                                                     ~2, ->7
  16     4    >   FETCH_OBJ_R                                      $3      !0
         5      > RETURN                                                   $3
         6*       JMP                                                      ->8
  20     7    > > RETURN                                                   null
  24     8*     > RETURN                                                   null

End of function returnproperty

End of class namedClass.

Class namedExtension:
Function returnproperty:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
Jump found. Position 1 = -2
Branch analysis from position: 8
Jump found. Position 1 = -2
filename:       /in/iukUl
function name:  returnProperty
number of ops:  10
compiled vars:  !0 = $propName
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  34     0  E >   RECV                                             !0      
  36     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      !0
         2        BOOL_NOT                                         ~2      ~1
         3      > JMPZ                                                     ~2, ->8
  38     4    >   FETCH_OBJ_R                                      $3      !0
         5        CONCAT                                           ~4      $3, '+from+standard+extenstion'
         6      > RETURN                                                   ~4
         7*       JMP                                                      ->9
  42     8    > > RETURN                                                   null
  46     9*     > RETURN                                                   null

End of function returnproperty

Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/iukUl
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   RECV                                             !0      
   8     1        ASSIGN_OBJ                                               'prop'
         2        OP_DATA                                                  !0
  10     3      > RETURN                                                   null

End of function __construct

End of class namedExtension.

Class class@anonymous:
Function returnproperty:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
Jump found. Position 1 = -2
Branch analysis from position: 8
Jump found. Position 1 = -2
filename:       /in/iukUl
function name:  returnProperty
number of ops:  10
compiled vars:  !0 = $propName
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  56     0  E >   RECV                                             !0      
  58     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      !0
         2        BOOL_NOT                                         ~2      ~1
         3      > JMPZ                                                     ~2, ->8
  60     4    >   FETCH_OBJ_R                                      $3      !0
         5        CONCAT                                           ~4      $3, '+from+anonymous+class'
         6      > RETURN                                                   ~4
         7*       JMP                                                      ->9
  64     8    > > RETURN                                                   null
  68     9*     > RETURN                                                   null

End of function returnproperty

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 7.3.0