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 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 $newObj->returnProperty();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i2cji
function name:  (null)
number of ops:  27
compiled vars:  !0 = $standardObject, !1 = $extObject, !2 = $anonObj, !3 = $newObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $4      'namedCLass'
          1        SEND_VAL_EX                                              'The+named+class'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   30     4        INIT_METHOD_CALL                                         !0, 'returnProperty'
          5        SEND_VAL_EX                                              'prop'
          6        DO_FCALL                                      0  $7      
          7        CONCAT                                           ~8      $7, '%0A'
          8        ECHO                                                     ~8
   50     9        NEW                                              $9      'namedExtension'
         10        SEND_VAL_EX                                              'The+named+extension'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $9
   52    13        INIT_METHOD_CALL                                         !1, 'returnProperty'
         14        SEND_VAL_EX                                              'prop'
         15        DO_FCALL                                      0  $12     
         16        CONCAT                                           ~13     $12, '%0A'
         17        ECHO                                                     ~13
   54    18        DECLARE_ANON_CLASS                               'namedclass'    'namedclass'
         19        NEW                                              $15     $14
         20        SEND_VAL_EX                                              'The+anonymous+class'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !2, $15
   72    23        INIT_METHOD_CALL                                         !3, 'returnProperty'
         24        DO_FCALL                                      0  $18     
         25        ECHO                                                     $18
         26      > RETURN                                                   1

Class namedClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i2cji
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/i2cji
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
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i2cji
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i2cji
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 namedClass@anonymous:
Function returnproperty:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i2cji
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 namedClass@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.01 ms | 1403 KiB | 13 Q