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('~Set-Cookie:((?:\h*[^=\n]+(?:=[^;\n]+)?)*)~', $s, $matches, PREG_SET_ORDER, 0)) { foreach ($matches as $x) { $tmp = preg_match_all('~(\w+)(?:=([^\s;][^;\n]*))?~', $x[1], $sub); if ($tmp) { $res[] = array_combine($sub[1], $sub[2]); } } } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 29
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 28
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 30
filename:       /in/dkqdo
function name:  (null)
number of ops:  34
compiled vars:  !0 = $s, !1 = $res, !2 = $matches, !3 = $x, !4 = $tmp, !5 = $sub
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                                                 '%7ESet-Cookie%3A%28%28%3F%3A%5Ch%2A%5B%5E%3D%5Cn%5D%2B%28%3F%3A%3D%5B%5E%3B%5Cn%5D%2B%29%3F%29%2A%29%7E'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 2
          7        SEND_VAL                                                 0
          8        DO_ICALL                                         $8      
          9      > JMPZ                                                     $8, ->30
    6    10    > > FE_RESET_R                                       $9      !2, ->29
         11    > > FE_FETCH_R                                               $9, !3, ->29
    7    12    >   INIT_FCALL                                               'preg_match_all'
         13        SEND_VAL                                                 '%7E%28%5Cw%2B%29%28%3F%3A%3D%28%5B%5E%5Cs%3B%5D%5B%5E%3B%5Cn%5D%2A%29%29%3F%7E'
         14        FETCH_DIM_R                                      ~10     !3, 1
         15        SEND_VAL                                                 ~10
         16        SEND_REF                                                 !5
         17        DO_ICALL                                         $11     
         18        ASSIGN                                                   !4, $11
    8    19      > JMPZ                                                     !4, ->28
    9    20    >   INIT_FCALL                                               'array_combine'
         21        FETCH_DIM_R                                      ~14     !5, 1
         22        SEND_VAL                                                 ~14
         23        FETCH_DIM_R                                      ~15     !5, 2
         24        SEND_VAL                                                 ~15
         25        DO_ICALL                                         $16     
         26        ASSIGN_DIM                                               !1
         27        OP_DATA                                                  $16
    6    28    > > JMP                                                      ->11
         29    >   FE_FREE                                                  $9
   13    30    >   INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.31 ms | 1400 KiB | 19 Q