3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = str_getcsv('key1=value1,key2=value2,...,key-n=value-n'); $newarray = array(); foreach($array as $pairs){ if(strpos($pairs, '=') !== FALSE){ list($key, $value) = explode('=', $pairs); $newarray[$key] = $value; } else { //no value present, what to do? } } print_r($newarray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/hkYil
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $newarray, !2 = $pairs, !3 = $key, !4 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'str_getcsv'
          1        SEND_VAL                                                     'key1%3Dvalue1%2Ckey2%3Dvalue2%2C...%2Ckey-n%3Dvalue-n'
          2        DO_ICALL                                             $5      
          3        ASSIGN                                                       !0, $5
    3     4        ASSIGN                                                       !1, <array>
    4     5      > FE_RESET_R                                           $8      !0, ->23
          6    > > FE_FETCH_R                                                   $8, !2, ->23
    5     7    >   FRAMELESS_ICALL_2                strpos              ~9      !2, '%3D'
          8        TYPE_CHECK                                      1018          ~9
          9      > JMPZ                                                         ~10, ->22
    6    10    >   INIT_FCALL                                                   'explode'
         11        SEND_VAL                                                     '%3D'
         12        SEND_VAR                                                     !2
         13        DO_ICALL                                             $11     
         14        FETCH_LIST_R                                         $12     $11, 0
         15        ASSIGN                                                       !3, $12
         16        FETCH_LIST_R                                         $14     $11, 1
         17        ASSIGN                                                       !4, $14
         18        FREE                                                         $11
    7    19        ASSIGN_DIM                                                   !1, !3
         20        OP_DATA                                                      !4
    5    21      > JMP                                                          ->22
    4    22    > > JMP                                                          ->6
         23    >   FE_FREE                                                      $8
   12    24        INIT_FCALL                                                   'print_r'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
149.86 ms | 1898 KiB | 16 Q