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); $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); $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 = 38, Position 2 = 44
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 78
Branch analysis from position: 73
2 jumps found. (Code = 46) Position 1 = 80, Position 2 = 82
Branch analysis from position: 80
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 91
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
Branch analysis from position: 82
Branch analysis from position: 78
Branch analysis from position: 44
2 jumps found. (Code = 46) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 57
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 78
Branch analysis from position: 73
Branch analysis from position: 78
Branch analysis from position: 57
Branch analysis from position: 48
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 = 38, Position 2 = 44
Branch analysis from position: 38
Branch analysis from position: 44
Branch analysis from position: 22
Branch analysis from position: 5
filename:       /in/9tkj9
function name:  (null)
number of ops:  95
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        ECHO                                                     ~17
   25    35        ASSIGN                                                   !0, <array>
   29    36        ARRAY_KEY_EXISTS                                         'event_id', !0
         37      > JMPZ                                                     ~19, ->44
   30    38    >   FETCH_DIM_R                                      ~20     !0, 'event_id'
         39        ASSIGN                                                   !1, ~20
   32    40        INIT_FCALL                                               'var_dump'
         41        SEND_VAL                                                 'C'
         42        DO_ICALL                                                 
         43      > JMP                                                      ->57
   33    44    >   ARRAY_KEY_EXISTS                                 ~23     'event_id', !0
         45      > JMPZ_EX                                          ~23     ~23, ->48
         46    >   ARRAY_KEY_EXISTS                                 ~24     'event_status', !0
         47        BOOL                                             ~23     ~24
         48    > > JMPZ                                                     ~23, ->57
   35    49    >   FETCH_DIM_R                                      ~25     !0, 'event_id'
         50        INIT_ARRAY                                       ~26     ~25, 'event_id'
   36    51        FETCH_DIM_R                                      ~27     !0, 'event_status'
         52        ADD_ARRAY_ELEMENT                                ~26     ~27, 'event_status'
   34    53        ASSIGN                                                   !1, ~26
   39    54        INIT_FCALL                                               'var_dump'
         55        SEND_VAL                                                 'D'
         56        DO_ICALL                                                 
   42    57    >   INIT_FCALL                                               'var_dump'
         58        SEND_VAR                                                 !1
         59        DO_ICALL                                                 
   44    60        INIT_FCALL                                               'str_repeat'
         61        SEND_VAL                                                 '%0A'
         62        SEND_VAL                                                 3
         63        DO_ICALL                                         $31     
         64        INIT_FCALL                                               'str_repeat'
         65        SEND_VAL                                                 '-'
         66        SEND_VAL                                                 100
         67        DO_ICALL                                         $32     
         68        CONCAT                                           ~33     $31, $32
         69        ECHO                                                     ~33
   46    70        ASSIGN                                                   !0, <array>
   50    71        ARRAY_KEY_EXISTS                                         'event_id', !0
         72      > JMPZ                                                     ~35, ->78
   51    73    >   FETCH_DIM_R                                      ~36     !0, 'event_id'
         74        ASSIGN                                                   !1, ~36
   53    75        INIT_FCALL                                               'var_dump'
         76        SEND_VAL                                                 'E'
         77        DO_ICALL                                                 
   55    78    >   ARRAY_KEY_EXISTS                                 ~39     'event_id', !0
         79      > JMPZ_EX                                          ~39     ~39, ->82
         80    >   ARRAY_KEY_EXISTS                                 ~40     'event_status', !0
         81        BOOL                                             ~39     ~40
         82    > > JMPZ                                                     ~39, ->91
   57    83    >   FETCH_DIM_R                                      ~41     !0, 'event_id'
         84        INIT_ARRAY                                       ~42     ~41, 'event_id'
   58    85        FETCH_DIM_R                                      ~43     !0, 'event_status'
         86        ADD_ARRAY_ELEMENT                                ~42     ~43, 'event_status'
   56    87        ASSIGN                                                   !1, ~42
   61    88        INIT_FCALL                                               'var_dump'
         89        SEND_VAL                                                 'F'
         90        DO_ICALL                                                 
   64    91    >   INIT_FCALL                                               'var_dump'
         92        SEND_VAR                                                 !1
         93        DO_ICALL                                                 
         94      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.08 ms | 1409 KiB | 17 Q