3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ObjectOne { protected $someParam = 'foo'; protected $someOtherParam = 'bar'; protected $saveMe = NULL; protected function update() { $this->someParam = 'FOO'; $this->someOtherParam = 'BAR'; return true; } protected function revert(){ $this->someParam = $this->saveMe->someParam; $this->someOtherParam = $this->saveMe->someOtherParam; $this->saveMe = NULL; } } class ObjectTwo extends ObjectOne { protected $someParam = 'faa'; protected $someOtherParam = 'bor'; public function update() { $this->saveMe = $this; if(parent::update()) { $this->someParam = 'poo'; if($this->someParam === 'foo') { return true; } else { $this->revert(); parent::update(); return false; } } else { return false; } } } $testOb = new ObjectTwo(); print_r($testOb->update());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dINlv
function name:  (null)
number of ops:  9
compiled vars:  !0 = $testOb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   NEW                                              $1      'ObjectTwo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   47     3        INIT_FCALL                                               'print_r'
          4        INIT_METHOD_CALL                                         !0, 'update'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class ObjectOne:
Function update:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dINlv
function name:  update
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN_OBJ                                               'someParam'
          1        OP_DATA                                                  'FOO'
    9     2        ASSIGN_OBJ                                               'someOtherParam'
          3        OP_DATA                                                  'BAR'
   10     4      > RETURN                                                   <true>
   11     5*     > RETURN                                                   null

End of function update

Function revert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dINlv
function name:  revert
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~1      'saveMe'
          1        FETCH_OBJ_R                                      ~2      ~1, 'someParam'
          2        ASSIGN_OBJ                                               'someParam'
          3        OP_DATA                                                  ~2
   15     4        FETCH_OBJ_R                                      ~4      'saveMe'
          5        FETCH_OBJ_R                                      ~5      ~4, 'someOtherParam'
          6        ASSIGN_OBJ                                               'someOtherParam'
          7        OP_DATA                                                  ~5
   16     8        ASSIGN_OBJ                                               'saveMe'
          9        OP_DATA                                                  null
   17    10      > RETURN                                                   null

End of function revert

End of class ObjectOne.

Class ObjectTwo:
Function update:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dINlv
function name:  update
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_THIS                                       ~1      
          1        ASSIGN_OBJ                                               'saveMe'
          2        OP_DATA                                                  ~1
   29     3        INIT_STATIC_METHOD_CALL                                  'update'
          4        DO_FCALL                                      0  $2      
          5      > JMPZ                                                     $2, ->19
   30     6    >   ASSIGN_OBJ                                               'someParam'
          7        OP_DATA                                                  'poo'
   32     8        FETCH_OBJ_R                                      ~4      'someParam'
          9        IS_IDENTICAL                                             ~4, 'foo'
         10      > JMPZ                                                     ~5, ->13
   33    11    > > RETURN                                                   <true>
         12*       JMP                                                      ->18
   35    13    >   INIT_METHOD_CALL                                         'revert'
         14        DO_FCALL                                      0          
   36    15        INIT_STATIC_METHOD_CALL                                  'update'
         16        DO_FCALL                                      0          
   37    17      > RETURN                                                   <false>
         18*       JMP                                                      ->20
   40    19    > > RETURN                                                   <false>
   42    20*     > RETURN                                                   null

End of function update

Function revert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dINlv
function name:  revert
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~1      'saveMe'
          1        FETCH_OBJ_R                                      ~2      ~1, 'someParam'
          2        ASSIGN_OBJ                                               'someParam'
          3        OP_DATA                                                  ~2
   15     4        FETCH_OBJ_R                                      ~4      'saveMe'
          5        FETCH_OBJ_R                                      ~5      ~4, 'someOtherParam'
          6        ASSIGN_OBJ                                               'someOtherParam'
          7        OP_DATA                                                  ~5
   16     8        ASSIGN_OBJ                                               'saveMe'
          9        OP_DATA                                                  null
   17    10      > RETURN                                                   null

End of function revert

End of class ObjectTwo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.13 ms | 1400 KiB | 15 Q