3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = "Set-Cookie: Name=Value; expires=Tue, 01 Jan 2018 00:00:00 GMT; domain=.site.com; path=/; httponly\nSet-Cookie: Name=Another_Value; expires=Wed, 02 Jan 2019 00:00:00 GMT; domain=.another_site.com; path=/newpath; httponly"; $res = array(); if (preg_match_all('~(?:\G(?!^);|(Set-Cookie:))\s*\K([^=\n]+)(?:=([^;\n]+))?~', $s, $matches, PREG_SET_ORDER, 0)) { foreach ($matches as $x) { if (isset($x[1]) && strlen($x[1])) { // Начало нового совпадения if (isset($tmp) && count($tmp) > 0) { $res[] = $tmp; } $tmp = array(); } $tmp[$x[2]] = isset($x[3]) && strlen($x[3]) ? $x[3] : ""; } if (isset($tmp) && count($tmp) > 0) { $res[] = $tmp; } } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 50
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 41
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 41
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 27
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 30, Position 2 = 33
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 33
Branch analysis from position: 26
Branch analysis from position: 23
Branch analysis from position: 27
Branch analysis from position: 17
Branch analysis from position: 41
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 47
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
Branch analysis from position: 47
Branch analysis from position: 41
Branch analysis from position: 50
filename:       /in/eYEDi
function name:  (null)
number of ops:  54
compiled vars:  !0 = $s, !1 = $res, !2 = $matches, !3 = $x, !4 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Set-Cookie%3A+Name%3DValue%3B+expires%3DTue%2C+01+Jan+2018+00%3A00%3A00+GMT%3B+domain%3D.site.com%3B+path%3D%2F%3B+httponly%0ASet-Cookie%3A+Name%3DAnother_Value%3B+expires%3DWed%2C+02+Jan+2019+00%3A00%3A00+GMT%3B+domain%3D.another_site.com%3B+path%3D%2Fnewpath%3B+httponly'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%7E%28%3F%3A%5CG%28%3F%21%5E%29%3B%7C%28Set-Cookie%3A%29%29%5Cs%2A%5CK%28%5B%5E%3D%5Cn%5D%2B%29%28%3F%3A%3D%28%5B%5E%3B%5Cn%5D%2B%29%29%3F%7E'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 2
          7        SEND_VAL                                                 0
          8        DO_ICALL                                         $7      
          9      > JMPZ                                                     $7, ->50
    6    10    > > FE_RESET_R                                       $8      !2, ->41
         11    > > FE_FETCH_R                                               $8, !3, ->41
    7    12    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !3, 1
         13      > JMPZ_EX                                          ~9      ~9, ->17
         14    >   FETCH_DIM_R                                      ~10     !3, 1
         15        STRLEN                                           ~11     ~10
         16        BOOL                                             ~9      ~11
         17    > > JMPZ                                                     ~9, ->27
    8    18    >   ISSET_ISEMPTY_CV                                 ~12     !4
         19      > JMPZ_EX                                          ~12     ~12, ->23
         20    >   COUNT                                            ~13     !4
         21        IS_SMALLER                                       ~14     0, ~13
         22        BOOL                                             ~12     ~14
         23    > > JMPZ                                                     ~12, ->26
    9    24    >   ASSIGN_DIM                                               !1
         25        OP_DATA                                                  !4
   11    26    >   ASSIGN                                                   !4, <array>
   13    27    >   FETCH_DIM_R                                      ~17     !3, 2
         28        ISSET_ISEMPTY_DIM_OBJ                         0  ~19     !3, 3
         29      > JMPZ_EX                                          ~19     ~19, ->33
         30    >   FETCH_DIM_R                                      ~20     !3, 3
         31        STRLEN                                           ~21     ~20
         32        BOOL                                             ~19     ~21
         33    > > JMPZ                                                     ~19, ->37
         34    >   FETCH_DIM_R                                      ~22     !3, 3
         35        QM_ASSIGN                                        ~23     ~22
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~23     ''
         38    >   ASSIGN_DIM                                               !4, ~17
         39        OP_DATA                                                  ~23
    6    40      > JMP                                                      ->11
         41    >   FE_FREE                                                  $8
   15    42        ISSET_ISEMPTY_CV                                 ~24     !4
         43      > JMPZ_EX                                          ~24     ~24, ->47
         44    >   COUNT                                            ~25     !4
         45        IS_SMALLER                                       ~26     0, ~25
         46        BOOL                                             ~24     ~26
         47    > > JMPZ                                                     ~24, ->50
   16    48    >   ASSIGN_DIM                                               !1
         49        OP_DATA                                                  !4
   19    50    >   INIT_FCALL                                               'print_r'
         51        SEND_VAR                                                 !1
         52        DO_ICALL                                                 
         53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
291.47 ms | 1016 KiB | 15 Q