3v4l.org

run code in 500+ 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:  14
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        FETCH_DIM_R                                          ~4      !0, 0
          3        FRAMELESS_ICALL_3                str_replace         ~5      !0, ~4
          4        OP_DATA                                                      !1
          5        ASSIGN                                                       !2, ~5
    6     6        INIT_FCALL                                                   'explode'
          7        FETCH_DIM_R                                          ~7      !0, 0
          8        SEND_VAL                                                     ~7
          9        SEND_VAR                                                     !2
         10        DO_ICALL                                             $8      
         11        ASSIGN                                                       !3, $8
    7    12      > RETURN                                                       !3
    8    13*     > RETURN                                                       null

End of function multiexplode

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
178.46 ms | 2053 KiB | 19 Q