<?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);
preferences:
26.21 ms | 409 KiB | 5 Q