3v4l.org

run code in 300+ PHP versions simultaneously
<?php $features = [ 'feature1' =>[ 'XYZ' => 'dfa2394bcf754a19b9e72d14207ad7d0', 'XZY' => '582a5b9654564055a2e56a0f9a7a399e', 'YZX' => '582a5b9654564055a2e56a0f9a7a399e' ], 'feature2' =>[ 'XYZ' => 'ert2394bcf754a19b9e72d14207ad7d0', 'XZY' => 'op2a5b9654564055a2e56a0f9a7a399e', 'YZX' => '1sd5b9654564055a2e56a0f9a7a399e' ] ]; foreach ($XML->article as $article) { foreach ($article->datagroup1->feature as $key => $feature) { // introduce $key if(isset($features[$feature['key']])){ $featureName = (string)$feature->en; if(isset($features[$feature['key']][$featureName])){ $articleData['properties'][$key]['id'] = $features[$feature['key']][$featureName]; // use $key } } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 29
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 29
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 27
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 26
Branch analysis from position: 26
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 27
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/pjqk8
function name:  (null)
number of ops:  31
compiled vars:  !0 = $features, !1 = $XML, !2 = $article, !3 = $feature, !4 = $key, !5 = $featureName, !6 = $articleData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        FETCH_OBJ_R                                      ~8      !1, 'article'
          2      > FE_RESET_R                                       $9      ~8, ->29
          3    > > FE_FETCH_R                                               $9, !2, ->29
   19     4    >   FETCH_OBJ_R                                      ~10     !2, 'datagroup1'
          5        FETCH_OBJ_R                                      ~11     ~10, 'feature'
          6      > FE_RESET_R                                       $12     ~11, ->27
          7    > > FE_FETCH_R                                       ~13     $12, !3, ->27
          8    >   ASSIGN                                                   !4, ~13
   20     9        FETCH_DIM_R                                      ~15     !3, 'key'
         10        ISSET_ISEMPTY_DIM_OBJ                         0          !0, ~15
         11      > JMPZ                                                     ~16, ->26
   21    12    >   FETCH_OBJ_R                                      ~17     !3, 'en'
         13        CAST                                          6  ~18     ~17
         14        ASSIGN                                                   !5, ~18
   22    15        FETCH_DIM_R                                      ~20     !3, 'key'
         16        FETCH_DIM_IS                                     ~21     !0, ~20
         17        ISSET_ISEMPTY_DIM_OBJ                         0          ~21, !5
         18      > JMPZ                                                     ~22, ->26
   23    19    >   FETCH_DIM_R                                      ~26     !3, 'key'
         20        FETCH_DIM_R                                      ~27     !0, ~26
         21        FETCH_DIM_R                                      ~28     ~27, !5
         22        FETCH_DIM_W                                      $23     !6, 'properties'
         23        FETCH_DIM_W                                      $24     $23, !4
         24        ASSIGN_DIM                                               $24, 'id'
         25        OP_DATA                                                  ~28
   19    26    > > JMP                                                      ->7
         27    >   FE_FREE                                                  $12
   18    28      > JMP                                                      ->3
         29    >   FE_FREE                                                  $9
   27    30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.17 ms | 1008 KiB | 13 Q