3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Fourth drill:"."<br><br>"; class MyClass4 { public $prop1 = "I'm a class property!"; public function __construct() { echo 'The class "', __CLASS__, '" was initiated!<br />'; } public function __destruct() { echo 'The class "', __CLASS__, '" was destroyed.<br />'; } public function __toString() { echo "Using the toString method: "; return $this->getProperty(); } public function setProperty($newval) { $this->prop1 = $newval; } public function getProperty() { return $this->prop1 . "<br />"; } } class MyOtherClass extends MyClass4 { public function newMethod() { echo "From a new method in " . __CLASS__ . ".<br />"; } } // Create a new object $newobj = new MyOtherClass; // Output the object as a string echo $newobj->newMethod(); // Use a method from the parent class. echo $newobj->getProperty(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  (null)
number of ops:  13
compiled vars:  !0 = $newobj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'Fourth+drill%3A%3Cbr%3E%3Cbr%3E'
    4     1        DECLARE_CLASS                                            'myclass4'
   35     2        DECLARE_CLASS                                            'myotherclass', 'myclass4'
   44     3        NEW                                              $1      'MyOtherClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   47     6        INIT_METHOD_CALL                                         !0, 'newMethod'
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
   50     9        INIT_METHOD_CALL                                         !0, 'getProperty'
         10        DO_FCALL                                      0  $5      
         11        ECHO                                                     $5
   53    12      > RETURN                                                   1

Class MyClass4:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'The+class+%22'
          1        ECHO                                                     'MyClass4'
          2        ECHO                                                     '%22+was+initiated%21%3Cbr+%2F%3E'
   11     3      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                     'The+class+%22'
          1        ECHO                                                     'MyClass4'
          2        ECHO                                                     '%22+was+destroyed.%3Cbr+%2F%3E'
   16     3      > RETURN                                                   null

End of function __destruct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  __toString
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ECHO                                                     'Using+the+toString+method%3A+'
   21     1        INIT_METHOD_CALL                                         'getProperty'
          2        DO_FCALL                                      0  $0      
          3        VERIFY_RETURN_TYPE                                       $0
          4      > RETURN                                                   $0
   22     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function __tostring

Function setproperty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  setProperty
number of ops:  4
compiled vars:  !0 = $newval
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        ASSIGN_OBJ                                               'prop1'
          2        OP_DATA                                                  !0
   27     3      > RETURN                                                   null

End of function setproperty

Function getproperty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  getProperty
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'prop1'
          1        CONCAT                                           ~1      ~0, '%3Cbr+%2F%3E'
          2      > RETURN                                                   ~1
   32     3*     > RETURN                                                   null

End of function getproperty

End of class MyClass4.

Class MyOtherClass:
Function newmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lALJ
function name:  newMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   ECHO                                                     'From+a+new+method+in+MyOtherClass.%3Cbr+%2F%3E'
   40     1      > RETURN                                                   null

End of function newmethod

End of class MyOtherClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.28 ms | 1403 KiB | 13 Q