3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $test = []; public function __construct() { $this->test['foo'] = 'foo'; $this->test['bar'] = 'bar'; } public function getTest(): array { return $this->test; } } $test = new Test; foreach($test->getTest() as $key => $value) { if ($key === 'foo') { $test->test['baz'] = 'baz'; } var_dump($value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/Dco0o
function name:  (null)
number of ops:  19
compiled vars:  !0 = $test, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   18     3        INIT_METHOD_CALL                                         !0, 'getTest'
          4        DO_FCALL                                      0  $6      
          5      > FE_RESET_R                                       $7      $6, ->17
          6    > > FE_FETCH_R                                       ~8      $7, !1, ->17
          7    >   ASSIGN                                                   !2, ~8
   19     8        IS_IDENTICAL                                             !2, 'foo'
          9      > JMPZ                                                     ~10, ->13
   20    10    >   FETCH_OBJ_W                                      $11     !0, 'test'
         11        ASSIGN_DIM                                               $11, 'baz'
         12        OP_DATA                                                  'baz'
   23    13    >   INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   18    16      > JMP                                                      ->6
         17    >   FE_FREE                                                  $7
   24    18      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dco0o
function name:  __construct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_W                                      $0      'test'
          1        ASSIGN_DIM                                               $0, 'foo'
          2        OP_DATA                                                  'foo'
    8     3        FETCH_OBJ_W                                      $2      'test'
          4        ASSIGN_DIM                                               $2, 'bar'
          5        OP_DATA                                                  'bar'
    9     6      > RETURN                                                   null

End of function __construct

Function gettest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dco0o
function name:  getTest
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      'test'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   13     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function gettest

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.09 ms | 1400 KiB | 15 Q