3v4l.org

run code in 500+ 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:  87
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        FRAMELESS_ICALL_3                str_replace         ~19     <array>, ''
         62        OP_DATA                                                      !0
         63        SEND_VAL                                                     ~19
         64        DO_ICALL                                             $20     
         65        SEND_VAR                                                     $20
         66        DO_ICALL                                                     
   13    67        INIT_FCALL                                                   'var_export'
         68        INIT_FCALL                                                   'explode'
         69        SEND_VAL                                                     '%5D%2C%5B'
         70        FRAMELESS_ICALL_2                trim                ~22     !0, '%5B%5D%2C'
         71        SEND_VAL                                                     ~22
         72        DO_ICALL                                             $23     
         73        SEND_VAR                                                     $23
         74        DO_ICALL                                                     
   16    75        FRAMELESS_ICALL_3                str_replace         ~25     <array>, <array>
         76        OP_DATA                                                      !0
         77        ASSIGN                                                       !0, ~25
   17    78        INIT_FCALL                                                   'explode'
         79        SEND_VAL                                                     '%2C'
         80        SEND_VAR                                                     !0
         81        DO_ICALL                                             $27     
         82        ASSIGN                                                       !0, $27
   18    83        INIT_FCALL                                                   'var_export'
         84        SEND_VAR                                                     !0
         85        DO_ICALL                                                     
         86      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.99 ms | 2187 KiB | 17 Q