3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $items = array( 'id' => 390 ); public function setItems(array $items) { if (!empty($items) && $items === $this->items) { reset($items); $items[key($items)] = clone current($items); } $this->items = $items; } public function getItems() { return $this->items; } } $test = new Test(); $newArray = array('id' => 360); $test->setItems($newArray); var_dump( $test->getItems());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XmpEf
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test, !1 = $newArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   26     3        ASSIGN                                                   !1, <array>
   27     4        INIT_METHOD_CALL                                         !0, 'setItems'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
   29     7        INIT_FCALL                                               'var_dump'
          8        INIT_METHOD_CALL                                         !0, 'getItems'
          9        DO_FCALL                                      0  $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class Test:
Function setitems:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 7
filename:       /in/XmpEf
function name:  setItems
number of ops:  23
compiled vars:  !0 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ_EX                                          ~2      ~2, ->7
          4    >   FETCH_OBJ_R                                      ~3      'items'
          5        IS_IDENTICAL                                     ~4      !0, ~3
          6        BOOL                                             ~2      ~4
          7    > > JMPZ                                                     ~2, ->20
   11     8    >   INIT_FCALL                                               'reset'
          9        SEND_REF                                                 !0
         10        DO_ICALL                                                 
   12    11        INIT_FCALL                                               'key'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $6      
         14        INIT_FCALL                                               'current'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $8      
         17        CLONE                                            ~9      $8
         18        ASSIGN_DIM                                               !0, $6
         19        OP_DATA                                                  ~9
   14    20    >   ASSIGN_OBJ                                               'items'
         21        OP_DATA                                                  !0
   15    22      > RETURN                                                   null

End of function setitems

Function getitems:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XmpEf
function name:  getItems
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'items'
          1      > RETURN                                                   ~0
   20     2*     > RETURN                                                   null

End of function getitems

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.83 ms | 1400 KiB | 21 Q