3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input="id=www session.timeout=120 session.server:0.host=127.0.0.1 session.server:0.port=1111 session.server:0.id=session1 session.server:1.host=127.0.0.1 session.server:1.port=1111 session.server:1.id=session2 image.width=640 image.height=480 image.watermark.small=wsmall.png image.watermark.normal=wnormal.png"; function parse(&$arr,$s,$numeric) { if( !preg_match( '/[.=:]/', $s, $matches, PREG_OFFSET_CAPTURE ) ) return; $m = $matches[0][1]; $key = substr( $s, 0, $m ); if( $numeric ) $key = intval( $key ); if( $s[$m] === '=' ) { $arr[$key] = substr( $s, $m+1 ); } else { if( !array_key_exists( $key, $arr ) ) $arr[$key] = array(); parse( $arr[$key], substr( $s, $m+1 ), $s[$m] === ':' ); } } $arr = array(); foreach( explode( PHP_EOL, $input ) as $line ) parse( $arr, $line, false ); var_dump( $arr ); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/ecHME
function name:  (null)
number of ops:  19
compiled vars:  !0 = $input, !1 = $arr, !2 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'id%3Dwww%0Asession.timeout%3D120%0Asession.server%3A0.host%3D127.0.0.1%0Asession.server%3A0.port%3D1111%0Asession.server%3A0.id%3Dsession1%0Asession.server%3A1.host%3D127.0.0.1%0Asession.server%3A1.port%3D1111%0Asession.server%3A1.id%3Dsession2%0Aimage.width%3D640%0Aimage.height%3D480%0Aimage.watermark.small%3Dwsmall.png%0Aimage.watermark.normal%3Dwnormal.png'
   34     1        ASSIGN                                                   !1, <array>
   35     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6      > FE_RESET_R                                       $6      $5, ->14
          7    > > FE_FETCH_R                                               $6, !2, ->14
          8    >   INIT_FCALL                                               'parse'
          9        SEND_REF                                                 !1
         10        SEND_VAR                                                 !2
         11        SEND_VAL                                                 <false>
         12        DO_FCALL                                      0          
         13      > JMP                                                      ->7
         14    >   FE_FREE                                                  $6
   37    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   39    18      > RETURN                                                   1

Function parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 24
filename:       /in/ecHME
function name:  parse
number of ops:  55
compiled vars:  !0 = $arr, !1 = $s, !2 = $numeric, !3 = $matches, !4 = $m, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   18     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAL                                                 '%2F%5B.%3D%3A%5D%2F'
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !3
          7        SEND_VAL                                                 256
          8        DO_ICALL                                         $6      
          9        BOOL_NOT                                         ~7      $6
         10      > JMPZ                                                     ~7, ->12
         11    > > RETURN                                                   null
   19    12    >   FETCH_DIM_R                                      ~8      !3, 0
         13        FETCH_DIM_R                                      ~9      ~8, 1
         14        ASSIGN                                                   !4, ~9
   20    15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 0
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $11     
         20        ASSIGN                                                   !5, $11
   21    21      > JMPZ                                                     !2, ->24
         22    >   CAST                                          4  ~13     !5
         23        ASSIGN                                                   !5, ~13
   23    24    >   FETCH_DIM_R                                      ~15     !1, !4
         25        IS_IDENTICAL                                             ~15, '%3D'
         26      > JMPZ                                                     ~16, ->35
   25    27    >   INIT_FCALL                                               'substr'
         28        SEND_VAR                                                 !1
         29        ADD                                              ~18     !4, 1
         30        SEND_VAL                                                 ~18
         31        DO_ICALL                                         $19     
         32        ASSIGN_DIM                                               !0, !5
         33        OP_DATA                                                  $19
         34      > JMP                                                      ->54
   29    35    >   ARRAY_KEY_EXISTS                                 ~20     !5, !0
         36        BOOL_NOT                                         ~21     ~20
         37      > JMPZ                                                     ~21, ->40
         38    >   ASSIGN_DIM                                               !0, !5
         39        OP_DATA                                                  <array>
   30    40    >   INIT_FCALL_BY_NAME                                       'parse'
         41        CHECK_FUNC_ARG                                           
         42        FETCH_DIM_FUNC_ARG                               $23     !0, !5
         43        SEND_FUNC_ARG                                            $23
         44        INIT_FCALL                                               'substr'
         45        SEND_VAR                                                 !1
         46        ADD                                              ~24     !4, 1
         47        SEND_VAL                                                 ~24
         48        DO_ICALL                                         $25     
         49        SEND_VAR_NO_REF_EX                                       $25
         50        FETCH_DIM_R                                      ~26     !1, !4
         51        IS_IDENTICAL                                     ~27     ~26, '%3A'
         52        SEND_VAL_EX                                              ~27
         53        DO_FCALL                                      0          
   32    54    > > RETURN                                                   null

End of function parse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
206.19 ms | 1407 KiB | 22 Q