3v4l.org

run code in 300+ PHP versions simultaneously
<?php $messageRow = [ 'event_id' => 123, 'event_status' => 50, ]; if (array_key_exists('event_id', $messageRow) && array_key_exists('event_status', $messageRow)) { $id = [ 'event_id' => $messageRow['event_id'], 'event_status' => $messageRow['event_status'], ]; var_dump('A'); } elseif (array_key_exists('event_id', $messageRow)) { $id = $messageRow['event_id']; var_dump('B'); } var_dump($id); echo str_repeat(PHP_EOL, 3) . str_repeat('-', 100) . PHP_EOL; $messageRow = [ 'event_id' => 123, 'event_status' => 50, ]; if (array_key_exists('event_id', $messageRow)) { $id = $messageRow['event_id']; var_dump('C'); } elseif (array_key_exists('event_id', $messageRow) && array_key_exists('event_status', $messageRow)) { $id = [ 'event_id' => $messageRow['event_id'], 'event_status' => $messageRow['event_status'], ]; var_dump('D'); } var_dump($id); echo str_repeat(PHP_EOL, 3) . str_repeat('-', 100) . PHP_EOL; $messageRow = [ 'event_id' => 123, 'event_status' => 50, ]; if (array_key_exists('event_id', $messageRow)) { $id = $messageRow['event_id']; var_dump('E'); } if (array_key_exists('event_id', $messageRow) && array_key_exists('event_status', $messageRow)) { $id = [ 'event_id' => $messageRow['event_id'], 'event_status' => $messageRow['event_status'], ]; var_dump('F'); } var_dump($id);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 80
Branch analysis from position: 75
2 jumps found. (Code = 46) Position 1 = 82, Position 2 = 84
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 93
Branch analysis from position: 85
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 93
Branch analysis from position: 84
Branch analysis from position: 80
Branch analysis from position: 45
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 58
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 80
Branch analysis from position: 75
Branch analysis from position: 80
Branch analysis from position: 58
Branch analysis from position: 49
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
Branch analysis from position: 45
Branch analysis from position: 22
Branch analysis from position: 5
filename:       /in/2pkil
function name:  (null)
number of ops:  97
compiled vars:  !0 = $messageRow, !1 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    8     1        ARRAY_KEY_EXISTS                                 ~3      'event_id', !0
          2      > JMPZ_EX                                          ~3      ~3, ->5
          3    >   ARRAY_KEY_EXISTS                                 ~4      'event_status', !0
          4        BOOL                                             ~3      ~4
          5    > > JMPZ                                                     ~3, ->15
   10     6    >   FETCH_DIM_R                                      ~5      !0, 'event_id'
          7        INIT_ARRAY                                       ~6      ~5, 'event_id'
   11     8        FETCH_DIM_R                                      ~7      !0, 'event_status'
          9        ADD_ARRAY_ELEMENT                                ~6      ~7, 'event_status'
    9    10        ASSIGN                                                   !1, ~6
   14    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAL                                                 'A'
         13        DO_ICALL                                                 
         14      > JMP                                                      ->22
   15    15    >   ARRAY_KEY_EXISTS                                         'event_id', !0
         16      > JMPZ                                                     ~10, ->22
   16    17    >   FETCH_DIM_R                                      ~11     !0, 'event_id'
         18        ASSIGN                                                   !1, ~11
   18    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAL                                                 'B'
         21        DO_ICALL                                                 
   21    22    >   INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
   23    25        INIT_FCALL                                               'str_repeat'
         26        SEND_VAL                                                 '%0A'
         27        SEND_VAL                                                 3
         28        DO_ICALL                                         $15     
         29        INIT_FCALL                                               'str_repeat'
         30        SEND_VAL                                                 '-'
         31        SEND_VAL                                                 100
         32        DO_ICALL                                         $16     
         33        CONCAT                                           ~17     $15, $16
         34        CONCAT                                           ~18     ~17, '%0A'
         35        ECHO                                                     ~18
   25    36        ASSIGN                                                   !0, <array>
   29    37        ARRAY_KEY_EXISTS                                         'event_id', !0
         38      > JMPZ                                                     ~20, ->45
   30    39    >   FETCH_DIM_R                                      ~21     !0, 'event_id'
         40        ASSIGN                                                   !1, ~21
   32    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAL                                                 'C'
         43        DO_ICALL                                                 
         44      > JMP                                                      ->58
   33    45    >   ARRAY_KEY_EXISTS                                 ~24     'event_id', !0
         46      > JMPZ_EX                                          ~24     ~24, ->49
         47    >   ARRAY_KEY_EXISTS                                 ~25     'event_status', !0
         48        BOOL                                             ~24     ~25
         49    > > JMPZ                                                     ~24, ->58
   35    50    >   FETCH_DIM_R                                      ~26     !0, 'event_id'
         51        INIT_ARRAY                                       ~27     ~26, 'event_id'
   36    52        FETCH_DIM_R                                      ~28     !0, 'event_status'
         53        ADD_ARRAY_ELEMENT                                ~27     ~28, 'event_status'
   34    54        ASSIGN                                                   !1, ~27
   39    55        INIT_FCALL                                               'var_dump'
         56        SEND_VAL                                                 'D'
         57        DO_ICALL                                                 
   42    58    >   INIT_FCALL                                               'var_dump'
         59        SEND_VAR                                                 !1
         60        DO_ICALL                                                 
   44    61        INIT_FCALL                                               'str_repeat'
         62        SEND_VAL                                                 '%0A'
         63        SEND_VAL                                                 3
         64        DO_ICALL                                         $32     
         65        INIT_FCALL                                               'str_repeat'
         66        SEND_VAL                                                 '-'
         67        SEND_VAL                                                 100
         68        DO_ICALL                                         $33     
         69        CONCAT                                           ~34     $32, $33
         70        CONCAT                                           ~35     ~34, '%0A'
         71        ECHO                                                     ~35
   46    72        ASSIGN                                                   !0, <array>
   50    73        ARRAY_KEY_EXISTS                                         'event_id', !0
         74      > JMPZ                                                     ~37, ->80
   51    75    >   FETCH_DIM_R                                      ~38     !0, 'event_id'
         76        ASSIGN                                                   !1, ~38
   53    77        INIT_FCALL                                               'var_dump'
         78        SEND_VAL                                                 'E'
         79        DO_ICALL                                                 
   55    80    >   ARRAY_KEY_EXISTS                                 ~41     'event_id', !0
         81      > JMPZ_EX                                          ~41     ~41, ->84
         82    >   ARRAY_KEY_EXISTS                                 ~42     'event_status', !0
         83        BOOL                                             ~41     ~42
         84    > > JMPZ                                                     ~41, ->93
   57    85    >   FETCH_DIM_R                                      ~43     !0, 'event_id'
         86        INIT_ARRAY                                       ~44     ~43, 'event_id'
   58    87        FETCH_DIM_R                                      ~45     !0, 'event_status'
         88        ADD_ARRAY_ELEMENT                                ~44     ~45, 'event_status'
   56    89        ASSIGN                                                   !1, ~44
   61    90        INIT_FCALL                                               'var_dump'
         91        SEND_VAL                                                 'F'
         92        DO_ICALL                                                 
   64    93    >   INIT_FCALL                                               'var_dump'
         94        SEND_VAR                                                 !1
         95        DO_ICALL                                                 
         96      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.54 ms | 1409 KiB | 17 Q