3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $_data = array(); public function set($data, $append = false) { if ($append) { $data = self::merge($this->_data, $data); } $this->_data = array(); foreach ($data as $key => $value) { $data = &$this->_data; $data = &$data[$key]; $data = $value; } } public static function merge($firstArray, $array) { foreach ($array as $key => &$value) { $firstArray[$key] = &$value; } return $firstArray; } } $query = new A; $query->set(array('param' => '1')); $query->set(array(), true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jcaem
function name:  (null)
number of ops:  11
compiled vars:  !0 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   36     3        INIT_METHOD_CALL                                         !0, 'set'
          4        SEND_VAL_EX                                              <array>
          5        DO_FCALL                                      0          
   37     6        INIT_METHOD_CALL                                         !0, 'set'
          7        SEND_VAL_EX                                              <array>
          8        SEND_VAL_EX                                              <true>
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class A:
Function set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/Jcaem
function name:  set
number of ops:  23
compiled vars:  !0 = $data, !1 = $append, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    9     2      > JMPZ                                                     !1, ->10
   11     3    >   INIT_STATIC_METHOD_CALL                                  'merge'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_OBJ_FUNC_ARG                               $4      '_data'
          6        SEND_FUNC_ARG                                            $4
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !0, $5
   14    10    >   ASSIGN_OBJ                                               '_data'
         11        OP_DATA                                                  <array>
   16    12      > FE_RESET_R                                       $8      !0, ->21
         13    > > FE_FETCH_R                                       ~9      $8, !2, ->21
         14    >   ASSIGN                                                   !3, ~9
   18    15        FETCH_OBJ_W                                      $11     '_data'
         16        ASSIGN_REF                                               !0, $11
   19    17        FETCH_DIM_W                                      $13     !0, !3
         18        ASSIGN_REF                                               !0, $13
   20    19        ASSIGN                                                   !0, !2
   16    20      > JMP                                                      ->13
         21    >   FE_FREE                                                  $8
   22    22      > RETURN                                                   null

End of function set

Function merge:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/Jcaem
function name:  merge
number of ops:  11
compiled vars:  !0 = $firstArray, !1 = $array, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2      > FE_RESET_RW                                      $4      !1, ->8
          3    > > FE_FETCH_RW                                      ~5      $4, !2, ->8
          4    >   ASSIGN                                                   !3, ~5
   28     5        FETCH_DIM_W                                      $7      !0, !3
          6        ASSIGN_REF                                               $7, !2
   26     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $4
   31     9      > RETURN                                                   !0
   32    10*     > RETURN                                                   null

End of function merge

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.14 ms | 1390 KiB | 13 Q