3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [ "a:1:{i:0;i:1;}", "a:3:{i:0;i:2;i:1;i:2;i:2;i:3;}", "a:3:{i:0;i:3;i:1;i:2;i:2;i:3;}", ]; $row = [['temp' => 1], ['temp1' => 2], ['temp3' => 2]]; $temp = array_map('unserialize', $arr); $brand_id = 1; $result = false; foreach ($temp as $key => $value) { if (!empty($value) && in_array($brand_id, $value)) { $result[] = $row[$key]; } } print_r($result); $brand_id = 2; $result = false; foreach ($temp as $key => $value) { if (!empty($value) && in_array($brand_id, $value)) { $result[] = $row[$key]; } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
Branch analysis from position: 17
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 41
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 41
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 40
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 40
Branch analysis from position: 36
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 22
filename:       /in/e44aG
function name:  (null)
number of ops:  46
compiled vars:  !0 = $arr, !1 = $row, !2 = $temp, !3 = $brand_id, !4 = $result, !5 = $value, !6 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    8     1        ASSIGN                                                       !1, <array>
    9     2        INIT_FCALL                                                   'array_map'
          3        SEND_VAL                                                     'unserialize'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $9      
          6        ASSIGN                                                       !2, $9
   10     7        ASSIGN                                                       !3, 1
   11     8        ASSIGN                                                       !4, <false>
   12     9      > FE_RESET_R                                           $13     !2, ->22
         10    > > FE_FETCH_R                                           ~14     $13, !5, ->22
         11    >   ASSIGN                                                       !6, ~14
   13    12        ISSET_ISEMPTY_CV                                     ~16     !5
         13        BOOL_NOT                                             ~17     ~16
         14      > JMPZ_EX                                              ~17     ~17, ->17
         15    >   FRAMELESS_ICALL_2                in_array            ~18     !3, !5
         16        BOOL                                                 ~17     ~18
         17    > > JMPZ                                                         ~17, ->21
   14    18    >   FETCH_DIM_R                                          ~20     !1, !6
         19        ASSIGN_DIM                                                   !4
         20        OP_DATA                                                      ~20
   12    21    > > JMP                                                          ->10
         22    >   FE_FREE                                                      $13
   17    23        INIT_FCALL                                                   'print_r'
         24        SEND_VAR                                                     !4
         25        DO_ICALL                                                     
   19    26        ASSIGN                                                       !3, 2
   20    27        ASSIGN                                                       !4, <false>
   21    28      > FE_RESET_R                                           $24     !2, ->41
         29    > > FE_FETCH_R                                           ~25     $24, !5, ->41
         30    >   ASSIGN                                                       !6, ~25
   22    31        ISSET_ISEMPTY_CV                                     ~27     !5
         32        BOOL_NOT                                             ~28     ~27
         33      > JMPZ_EX                                              ~28     ~28, ->36
         34    >   FRAMELESS_ICALL_2                in_array            ~29     !3, !5
         35        BOOL                                                 ~28     ~29
         36    > > JMPZ                                                         ~28, ->40
   23    37    >   FETCH_DIM_R                                          ~31     !1, !6
         38        ASSIGN_DIM                                                   !4
         39        OP_DATA                                                      ~31
   21    40    > > JMP                                                          ->29
         41    >   FE_FREE                                                      $24
   26    42        INIT_FCALL                                                   'print_r'
         43        SEND_VAR                                                     !4
         44        DO_ICALL                                                     
         45      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.59 ms | 2368 KiB | 15 Q