3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subscriberTags = json_decode('{"hu":2174325}'); $availableTags = json_decode('{"cz":2174305,"hu":2174325,"at":2174333,"de":2174353,"pl":2174365,"sk":2174373,"gb":2174381,"nl":2174385,"gr":2174877,"ru":2174881}'); $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 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 28
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 27
Branch analysis from position: 24
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 50
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 50
Branch analysis from position: 34
2 jumps found. (Code = 46) Position 1 = 40, Position 2 = 46
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 49
Branch analysis from position: 46
Branch analysis from position: 50
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 71
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 71
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 66
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 66
Branch analysis from position: 71
2 jumps found. (Code = 77) Position 1 = 73, Position 2 = 79
Branch analysis from position: 73
2 jumps found. (Code = 78) Position 1 = 74, Position 2 = 79
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
Branch analysis from position: 71
Branch analysis from position: 50
Branch analysis from position: 28
filename:       /in/vvaUv
function name:  (null)
number of ops:  81
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        DO_ICALL                                         $7      
          3        ASSIGN                                                   !0, $7
    4     4        INIT_FCALL                                               'json_decode'
          5        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'
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !1, $9
    6     8        ASSIGN                                                   !2, <array>
    8     9        ASSIGN                                                   !3, <array>
    9    10        ASSIGN                                                   !4, <array>
   10    11      > FE_RESET_R                                       $14     <array>, ->28
         12    > > FE_FETCH_R                                               $14, !5, ->28
   12    13    >   ASSIGN_DIM                                               !2
         14        OP_DATA                                                  !5
   14    15        ARRAY_KEY_EXISTS                                 ~16     !5, !0
         16        BOOL_NOT                                         ~17     ~16
         17      > JMPZ_EX                                          ~17     ~17, ->24
         18    >   INIT_FCALL                                               'in_array'
         19        SEND_VAR                                                 !5
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $18     
         22        BOOL_NOT                                         ~19     $18
         23        BOOL                                             ~17     ~19
         24    > > JMPZ                                                     ~17, ->27
   15    25    >   ASSIGN_DIM                                               !3
         26        OP_DATA                                                  !5
   10    27    > > JMP                                                      ->12
         28    >   FE_FREE                                                  $14
   19    29        INIT_FCALL                                               'array_keys'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $21     
         32      > FE_RESET_R                                       $22     $21, ->50
         33    > > FE_FETCH_R                                               $22, !6, ->50
   20    34    >   INIT_FCALL                                               'in_array'
         35        SEND_VAR                                                 !6
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $23     
         38        BOOL_NOT                                         ~24     $23
         39      > JMPZ_EX                                          ~24     ~24, ->46
         40    >   INIT_FCALL                                               'in_array'
         41        SEND_VAR                                                 !6
         42        SEND_VAR                                                 !4
         43        DO_ICALL                                         $25     
         44        BOOL_NOT                                         ~26     $25
         45        BOOL                                             ~24     ~26
         46    > > JMPZ                                                     ~24, ->49
   21    47    >   ASSIGN_DIM                                               !4
         48        OP_DATA                                                  !6
   19    49    > > JMP                                                      ->33
         50    >   FE_FREE                                                  $22
   25    51      > FE_RESET_R                                       $28     !3, ->71
         52    > > FE_FETCH_R                                               $28, !6, ->71
   26    53    >   ARRAY_KEY_EXISTS                                 ~29     !6, !1
         54        BOOL_NOT                                         ~30     ~29
         55      > JMPZ                                                     ~30, ->66
   27    56    >   CONCAT                                           ~31     'ADD+TAG+', !6
         57        CONCAT                                           ~32     ~31, '%0A'
         58        ECHO                                                     ~32
   28    59        INIT_FCALL                                               'rand'
         60        SEND_VAL                                                 0
         61        SEND_VAL                                                 100
         62        DO_ICALL                                         $34     
         63        CONCAT                                           ~35     'created', $34
         64        ASSIGN_DIM                                               !1, !6
         65        OP_DATA                                                  ~35
   31    66    >   FETCH_DIM_R                                      ~36     !1, !6
         67        CONCAT                                           ~37     'ADD+TO+USER', ~36
         68        CONCAT                                           ~38     ~37, '%0A'
         69        ECHO                                                     ~38
   25    70      > JMP                                                      ->52
         71    >   FE_FREE                                                  $28
   34    72      > FE_RESET_R                                       $39     !4, ->79
         73    > > FE_FETCH_R                                               $39, !6, ->79
   35    74    >   FETCH_DIM_R                                      ~40     !1, !6
         75        CONCAT                                           ~41     'REMOVE+FROM+USER', ~40
         76        CONCAT                                           ~42     ~41, '%0A'
         77        ECHO                                                     ~42
   34    78      > JMP                                                      ->73
         79    >   FE_FREE                                                  $39
   36    80      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.74 ms | 1404 KiB | 21 Q