3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subscriberTags = json_decode('{"hu":2174325}', true); $availableTags = json_decode('{"cz":2174305,"hu":2174325,"at":2174333,"de":2174353,"pl":2174365,"sk":2174373,"gb":2174381,"nl":2174385,"gr":2174877,"ru":2174881}', true); $actualSubscriberTags = []; $addTags = []; $removeTags = []; foreach (['us', 'hu'] as $country) { $actualSubscriberTags[] = $country; if (!array_key_exists($country, $subscriberTags) && !in_array($country, $addTags)) { $addTags[] = $country; } } foreach (array_keys($subscriberTags) as $tag) { if (!in_array($tag, $actualSubscriberTags) && !in_array($tag, $removeTags)) { $removeTags[] = $tag; } } foreach ($addTags as $tag) { if (!array_key_exists($tag, $availableTags)) { echo 'ADD TAG ' . $tag . PHP_EOL; $availableTags[$tag] = 'created' . rand(0, 100); } echo 'ADD TO USER' . $availableTags[$tag] . PHP_EOL; } foreach ($removeTags as $tag) { echo 'REMOVE FROM USER' . $availableTags[$tag] . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 26
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 29
Branch analysis from position: 26
Branch analysis from position: 30
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 52
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 52
Branch analysis from position: 36
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 48
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 51
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 51
Branch analysis from position: 48
Branch analysis from position: 52
2 jumps found. (Code = 77) Position 1 = 54, Position 2 = 73
Branch analysis from position: 54
2 jumps found. (Code = 78) Position 1 = 55, Position 2 = 73
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 68
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
Branch analysis from position: 68
Branch analysis from position: 73
2 jumps found. (Code = 77) Position 1 = 75, Position 2 = 81
Branch analysis from position: 75
2 jumps found. (Code = 78) Position 1 = 76, Position 2 = 81
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
Branch analysis from position: 81
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
Branch analysis from position: 73
Branch analysis from position: 52
Branch analysis from position: 30
filename:       /in/tejfZ
function name:  (null)
number of ops:  83
compiled vars:  !0 = $subscriberTags, !1 = $availableTags, !2 = $actualSubscriberTags, !3 = $addTags, !4 = $removeTags, !5 = $country, !6 = $tag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%7B%22hu%22%3A2174325%7D'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !0, $7
    4     5        INIT_FCALL                                               'json_decode'
          6        SEND_VAL                                                 '%7B%22cz%22%3A2174305%2C%22hu%22%3A2174325%2C%22at%22%3A2174333%2C%22de%22%3A2174353%2C%22pl%22%3A2174365%2C%22sk%22%3A2174373%2C%22gb%22%3A2174381%2C%22nl%22%3A2174385%2C%22gr%22%3A2174877%2C%22ru%22%3A2174881%7D'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !1, $9
    6    10        ASSIGN                                                   !2, <array>
    8    11        ASSIGN                                                   !3, <array>
    9    12        ASSIGN                                                   !4, <array>
   10    13      > FE_RESET_R                                       $14     <array>, ->30
         14    > > FE_FETCH_R                                               $14, !5, ->30
   12    15    >   ASSIGN_DIM                                               !2
         16        OP_DATA                                                  !5
   14    17        ARRAY_KEY_EXISTS                                 ~16     !5, !0
         18        BOOL_NOT                                         ~17     ~16
         19      > JMPZ_EX                                          ~17     ~17, ->26
         20    >   INIT_FCALL                                               'in_array'
         21        SEND_VAR                                                 !5
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $18     
         24        BOOL_NOT                                         ~19     $18
         25        BOOL                                             ~17     ~19
         26    > > JMPZ                                                     ~17, ->29
   15    27    >   ASSIGN_DIM                                               !3
         28        OP_DATA                                                  !5
   10    29    > > JMP                                                      ->14
         30    >   FE_FREE                                                  $14
   19    31        INIT_FCALL                                               'array_keys'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $21     
         34      > FE_RESET_R                                       $22     $21, ->52
         35    > > FE_FETCH_R                                               $22, !6, ->52
   20    36    >   INIT_FCALL                                               'in_array'
         37        SEND_VAR                                                 !6
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                         $23     
         40        BOOL_NOT                                         ~24     $23
         41      > JMPZ_EX                                          ~24     ~24, ->48
         42    >   INIT_FCALL                                               'in_array'
         43        SEND_VAR                                                 !6
         44        SEND_VAR                                                 !4
         45        DO_ICALL                                         $25     
         46        BOOL_NOT                                         ~26     $25
         47        BOOL                                             ~24     ~26
         48    > > JMPZ                                                     ~24, ->51
   21    49    >   ASSIGN_DIM                                               !4
         50        OP_DATA                                                  !6
   19    51    > > JMP                                                      ->35
         52    >   FE_FREE                                                  $22
   25    53      > FE_RESET_R                                       $28     !3, ->73
         54    > > FE_FETCH_R                                               $28, !6, ->73
   26    55    >   ARRAY_KEY_EXISTS                                 ~29     !6, !1
         56        BOOL_NOT                                         ~30     ~29
         57      > JMPZ                                                     ~30, ->68
   27    58    >   CONCAT                                           ~31     'ADD+TAG+', !6
         59        CONCAT                                           ~32     ~31, '%0A'
         60        ECHO                                                     ~32
   28    61        INIT_FCALL                                               'rand'
         62        SEND_VAL                                                 0
         63        SEND_VAL                                                 100
         64        DO_ICALL                                         $34     
         65        CONCAT                                           ~35     'created', $34
         66        ASSIGN_DIM                                               !1, !6
         67        OP_DATA                                                  ~35
   31    68    >   FETCH_DIM_R                                      ~36     !1, !6
         69        CONCAT                                           ~37     'ADD+TO+USER', ~36
         70        CONCAT                                           ~38     ~37, '%0A'
         71        ECHO                                                     ~38
   25    72      > JMP                                                      ->54
         73    >   FE_FREE                                                  $28
   34    74      > FE_RESET_R                                       $39     !4, ->81
         75    > > FE_FETCH_R                                               $39, !6, ->81
   35    76    >   FETCH_DIM_R                                      ~40     !1, !6
         77        CONCAT                                           ~41     'REMOVE+FROM+USER', ~40
         78        CONCAT                                           ~42     ~41, '%0A'
         79        ECHO                                                     ~42
   34    80      > JMP                                                      ->75
         81    >   FE_FREE                                                  $39
   36    82      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.38 ms | 1404 KiB | 21 Q