3v4l.org

run code in 300+ 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 = 26
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 26
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 25
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/hkYil
function name:  (null)
number of ops:  31
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, ->26
          6    > > FE_FETCH_R                                               $8, !2, ->26
    5     7    >   INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !2
          9        SEND_VAL                                                 '%3D'
         10        DO_ICALL                                         $9      
         11        TYPE_CHECK                                  1018          $9
         12      > JMPZ                                                     ~10, ->25
    6    13    >   INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '%3D'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $11     
         17        FETCH_LIST_R                                     $12     $11, 0
         18        ASSIGN                                                   !3, $12
         19        FETCH_LIST_R                                     $14     $11, 1
         20        ASSIGN                                                   !4, $14
         21        FREE                                                     $11
    7    22        ASSIGN_DIM                                               !1, !3
         23        OP_DATA                                                  !4
    5    24      > JMP                                                      ->25
    4    25    > > JMP                                                      ->6
         26    >   FE_FREE                                                  $8
   12    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.3 ms | 1014 KiB | 17 Q