3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stuff = "[1379082600-1379082720],[1379082480-1379082480],[1379514420-1379515800],"; var_export(preg_split('/[\],[]+/', $stuff, 0, PREG_SPLIT_NO_EMPTY)); // 72 steps var_export(preg_split('/[^\d-]+/', $stuff, 0, PREG_SPLIT_NO_EMPTY)); // 72 steps var_export(preg_match_all('/[\d-]+/', $stuff, $matches) ? $matches[0] : 'failed'); // my pattern #1: 16 steps var_export(preg_match_all('/\[(.*?)\]/' ,$stuff, $matches) ? $matches[0] : 'failed'); // bora's pattern: 144 steps var_export(preg_match_all('/[^\],[]+/', $stuff, $matches) ? $matches[0] : 'failed'); // my pattern #2: 16 steps var_export(explode(",", str_replace(["[", "]"], "", $stuff))); // Andy Gee's method (flawed / incorrect -- 4 elements in output) var_export(explode('],[', trim($stuff, '[],'))); // Alex Howansky's is the cleanest, efficient / correct method // OP's method (flawed / incorrect -- 4 elements in output) $stuff = str_replace(["[","]"], ["", ""], $stuff); $stuff = explode(",",$stuff); var_export($stuff);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 55
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 55
Branch analysis from position: 52
Branch analysis from position: 55
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
Branch analysis from position: 42
filename:       /in/jAbpZ
function name:  (null)
number of ops:  96
compiled vars:  !0 = $stuff, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B1379082600-1379082720%5D%2C%5B1379082480-1379082480%5D%2C%5B1379514420-1379515800%5D%2C'
    4     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5B%5C%5D%2C%5B%5D%2B%2F'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 1
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
    5    10        INIT_FCALL                                               'var_export'
         11        INIT_FCALL                                               'preg_split'
         12        SEND_VAL                                                 '%2F%5B%5E%5Cd-%5D%2B%2F'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $5      
         17        SEND_VAR                                                 $5
         18        DO_ICALL                                                 
    7    19        INIT_FCALL                                               'var_export'
         20        INIT_FCALL                                               'preg_match_all'
         21        SEND_VAL                                                 '%2F%5B%5Cd-%5D%2B%2F'
         22        SEND_VAR                                                 !0
         23        SEND_REF                                                 !1
         24        DO_ICALL                                         $7      
         25      > JMPZ                                                     $7, ->29
         26    >   FETCH_DIM_R                                      ~8      !1, 0
         27        QM_ASSIGN                                        ~9      ~8
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~9      'failed'
         30    >   SEND_VAL                                                 ~9
         31        DO_ICALL                                                 
    8    32        INIT_FCALL                                               'var_export'
         33        INIT_FCALL                                               'preg_match_all'
         34        SEND_VAL                                                 '%2F%5C%5B%28.%2A%3F%29%5C%5D%2F'
         35        SEND_VAR                                                 !0
         36        SEND_REF                                                 !1
         37        DO_ICALL                                         $11     
         38      > JMPZ                                                     $11, ->42
         39    >   FETCH_DIM_R                                      ~12     !1, 0
         40        QM_ASSIGN                                        ~13     ~12
         41      > JMP                                                      ->43
         42    >   QM_ASSIGN                                        ~13     'failed'
         43    >   SEND_VAL                                                 ~13
         44        DO_ICALL                                                 
    9    45        INIT_FCALL                                               'var_export'
         46        INIT_FCALL                                               'preg_match_all'
         47        SEND_VAL                                                 '%2F%5B%5E%5C%5D%2C%5B%5D%2B%2F'
         48        SEND_VAR                                                 !0
         49        SEND_REF                                                 !1
         50        DO_ICALL                                         $15     
         51      > JMPZ                                                     $15, ->55
         52    >   FETCH_DIM_R                                      ~16     !1, 0
         53        QM_ASSIGN                                        ~17     ~16
         54      > JMP                                                      ->56
         55    >   QM_ASSIGN                                        ~17     'failed'
         56    >   SEND_VAL                                                 ~17
         57        DO_ICALL                                                 
   11    58        INIT_FCALL                                               'var_export'
         59        INIT_FCALL                                               'explode'
         60        SEND_VAL                                                 '%2C'
         61        INIT_FCALL                                               'str_replace'
         62        SEND_VAL                                                 <array>
         63        SEND_VAL                                                 ''
         64        SEND_VAR                                                 !0
         65        DO_ICALL                                         $19     
         66        SEND_VAR                                                 $19
         67        DO_ICALL                                         $20     
         68        SEND_VAR                                                 $20
         69        DO_ICALL                                                 
   13    70        INIT_FCALL                                               'var_export'
         71        INIT_FCALL                                               'explode'
         72        SEND_VAL                                                 '%5D%2C%5B'
         73        INIT_FCALL                                               'trim'
         74        SEND_VAR                                                 !0
         75        SEND_VAL                                                 '%5B%5D%2C'
         76        DO_ICALL                                         $22     
         77        SEND_VAR                                                 $22
         78        DO_ICALL                                         $23     
         79        SEND_VAR                                                 $23
         80        DO_ICALL                                                 
   16    81        INIT_FCALL                                               'str_replace'
         82        SEND_VAL                                                 <array>
         83        SEND_VAL                                                 <array>
         84        SEND_VAR                                                 !0
         85        DO_ICALL                                         $25     
         86        ASSIGN                                                   !0, $25
   17    87        INIT_FCALL                                               'explode'
         88        SEND_VAL                                                 '%2C'
         89        SEND_VAR                                                 !0
         90        DO_ICALL                                         $27     
         91        ASSIGN                                                   !0, $27
   18    92        INIT_FCALL                                               'var_export'
         93        SEND_VAR                                                 !0
         94        DO_ICALL                                                 
         95      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.92 ms | 1012 KiB | 19 Q