3v4l.org

run code in 300+ PHP versions simultaneously
<?php function multiexplode ($delimiters,$string) { $ready = str_replace($delimiters, $delimiters[0], $string); $launch = explode($delimiters[0], $ready); return $launch; } $text = "När:Sent lördag kväll och natt till söndag\nVar:Främst norra Jämtland\nIntensitet:Väst ca 21 m/s\nKommentar:-"; $exploded = multiexplode(array("\n",":"), $text); $result = array_intersect_key($exploded, array_flip(range(1,count($exploded),2))); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tbgLM
function name:  (null)
number of ops:  24
compiled vars:  !0 = $text, !1 = $exploded, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 'N%C3%A4r%3ASent+l%C3%B6rdag+kv%C3%A4ll+och+natt+till+s%C3%B6ndag%0AVar%3AFr%C3%A4mst+norra+J%C3%A4mtland%0AIntensitet%3AV%C3%A4st+ca+21+m%2Fs%0AKommentar%3A-'
   12     1        INIT_FCALL                                               'multiexplode'
          2        SEND_VAL                                                 <array>
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   13     6        INIT_FCALL                                               'array_intersect_key'
          7        SEND_VAR                                                 !1
          8        INIT_FCALL                                               'array_flip'
          9        INIT_FCALL                                               'range'
         10        SEND_VAL                                                 1
         11        COUNT                                            ~6      !1
         12        SEND_VAL                                                 ~6
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                         $9      
         19        ASSIGN                                                   !2, $9
   14    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Function multiexplode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tbgLM
function name:  multiexplode
number of ops:  17
compiled vars:  !0 = $delimiters, !1 = $string, !2 = $ready, !3 = $launch
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAR                                                 !0
          4        FETCH_DIM_R                                      ~4      !0, 0
          5        SEND_VAL                                                 ~4
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
    6     9        INIT_FCALL                                               'explode'
         10        FETCH_DIM_R                                      ~7      !0, 0
         11        SEND_VAL                                                 ~7
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !3, $8
    7    15      > RETURN                                                   !3
    8    16*     > RETURN                                                   null

End of function multiexplode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.37 ms | 1407 KiB | 26 Q