3v4l.org

run code in 300+ PHP versions simultaneously
<?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 'property not found'; } } } $standardObject = new namedClass('The named class'); echo $standardObject->returnProperty('prop')."\n"; class namedExtension extends namedClass{ protected $anotherProp = 'Extended property'; } $extObject = new namedExtension('The named extension'); echo $extObject->returnProperty('anotherProp')."\n"; $anonObj = new class('The anonymous class') extends namedClass{ private $anotherProp = 'Anonymous property'; }; echo $anonObj->returnProperty('anotherProp');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q9kaL
function name:  (null)
number of ops:  28
compiled vars:  !0 = $standardObject, !1 = $extObject, !2 = $anonObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $3      'namedClass'
          1        SEND_VAL_EX                                              'The+named+class'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   30     4        INIT_METHOD_CALL                                         !0, 'returnProperty'
          5        SEND_VAL_EX                                              'prop'
          6        DO_FCALL                                      0  $6      
          7        CONCAT                                           ~7      $6, '%0A'
          8        ECHO                                                     ~7
   38     9        NEW                                              $8      'namedExtension'
         10        SEND_VAL_EX                                              'The+named+extension'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $8
   40    13        INIT_METHOD_CALL                                         !1, 'returnProperty'
         14        SEND_VAL_EX                                              'anotherProp'
         15        DO_FCALL                                      0  $11     
         16        CONCAT                                           ~12     $11, '%0A'
         17        ECHO                                                     ~12
   42    18        DECLARE_ANON_CLASS                               <unknown> 'namedclass'
         19        NEW                                              $14     $13
         20        SEND_VAL_EX                                              'The+anonymous+class'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !2, $14
   48    23        INIT_METHOD_CALL                                         !2, 'returnProperty'
         24        SEND_VAL_EX                                              'anotherProp'
         25        DO_FCALL                                      0  $17     
         26        ECHO                                                     $17
         27      > RETURN                                                   1

Class namedClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q9kaL
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
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q9kaL
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                                                   'property+not+found'
   24     8*     > RETURN                                                   null

End of function returnproperty

End of class namedClass.

Class namedExtension:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q9kaL
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
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q9kaL
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                                                   'property+not+found'
   24     8*     > RETURN                                                   null

End of function returnproperty

End of class namedExtension.

Class namedClass@anonymous: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.63 ms | 1399 KiB | 13 Q